mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
lbagent: fix config for sticky session cookie
- account for user specific cookie name for insert mode - dont tamper cache instructions from backend server for server mode
This commit is contained in:
@@ -285,14 +285,18 @@ func (b *LoadbalancerCorpus) genHaproxyConfigBackend(data map[string]interface{}
|
||||
stickyCookie := ""
|
||||
switch listener.StickySessionType {
|
||||
case "insert":
|
||||
stickyCookie = "cookie SERVERID insert indirect nocache"
|
||||
cookie := listener.StickySessionCookie
|
||||
if cookie == "" {
|
||||
cookie = "SERVERID"
|
||||
}
|
||||
stickyCookie = fmt.Sprintf("cookie %s insert indirect nocache", cookie)
|
||||
if maxIdle := listener.StickySessionCookieTimeout; maxIdle > 0 {
|
||||
stickyCookie += fmt.Sprintf(" maxidle %ds", maxIdle)
|
||||
}
|
||||
case "server":
|
||||
cookie := listener.StickySessionCookie
|
||||
if cookie != "" {
|
||||
stickyCookie = fmt.Sprintf("cookie %q rewrite nocache", cookie)
|
||||
stickyCookie = fmt.Sprintf("cookie %q rewrite", cookie)
|
||||
}
|
||||
}
|
||||
if stickyCookie != "" {
|
||||
|
||||
Reference in New Issue
Block a user