Reorder sticky session definitions
This commit is contained in:
parent
81fddb4ccf
commit
3d7c44735a
1 changed files with 7 additions and 6 deletions
13
server.go
13
server.go
|
@ -546,20 +546,21 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
|
||||||
}
|
}
|
||||||
|
|
||||||
stickysession := configuration.Backends[frontend.Backend].LoadBalancer.Sticky
|
stickysession := configuration.Backends[frontend.Backend].LoadBalancer.Sticky
|
||||||
if stickysession {
|
var cookiename string
|
||||||
sticky := roundrobin.NewStickySession(cookiename)
|
var sticky *roundrobin.StickySession
|
||||||
cookiename := "_TRAEFIK_SERVERNAME"
|
|
||||||
|
|
||||||
|
if stickysession {
|
||||||
|
sticky = roundrobin.NewStickySession(cookiename)
|
||||||
|
cookiename = "_TRAEFIK_SERVERNAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
switch lbMethod {
|
switch lbMethod {
|
||||||
case types.Drr:
|
case types.Drr:
|
||||||
log.Debugf("Creating load-balancer drr")
|
log.Debugf("Creating load-balancer drr")
|
||||||
|
rebalancer, _ := roundrobin.NewRebalancer(rr, roundrobin.RebalancerLogger(oxyLogger))
|
||||||
if stickysession {
|
if stickysession {
|
||||||
log.Debugf("... setting to sticky session with cookie named %v", cookiename)
|
log.Debugf("... setting to sticky session with cookie named %v", cookiename)
|
||||||
rebalancer, _ := roundrobin.NewRebalancer(rr, roundrobin.RebalancerLogger(oxyLogger), roundrobin.RebalancerStickySession(sticky))
|
rebalancer, _ = roundrobin.NewRebalancer(rr, roundrobin.RebalancerLogger(oxyLogger), roundrobin.RebalancerStickySession(sticky))
|
||||||
} else {
|
|
||||||
rebalancer, _ := roundrobin.NewRebalancer(rr, roundrobin.RebalancerLogger(oxyLogger))
|
|
||||||
}
|
}
|
||||||
lb = rebalancer
|
lb = rebalancer
|
||||||
for serverName, server := range configuration.Backends[frontend.Backend].Servers {
|
for serverName, server := range configuration.Backends[frontend.Backend].Servers {
|
||||||
|
|
Loading…
Add table
Reference in a new issue