Add sticky session support to Traefik.

This change adds sticky session support, by using the new
oxy/rr/StickySession feature.

To use it, set traefik.backend.sticky to true.

This is currently only implemented in the wrr load balancer, and against
the Marathon backend, but lifting it should be very doable.

In the wrr load balancer, a cookie called _TRAEFIK_SERVERNAME will be
set with the backend to use.  If the cookie is altered to an invalid
backend server, or the server is removed from the load balancer, the
next server will be used instead.

Otherwise, the cookie will be checked in Oxy's rr on access and if valid
the connection will be wired through to it.
This commit is contained in:
Owen Marshall 2016-05-13 10:22:11 -04:00 committed by Emile Vauge
parent a13549cc28
commit dc52abf4ce
No known key found for this signature in database
GPG key ID: D808B4C167352E59
5 changed files with 21 additions and 1 deletions

View file

@ -24,6 +24,7 @@ type MaxConn struct {
// LoadBalancer holds load balancing configuration.
type LoadBalancer struct {
Method string `json:"method,omitempty"`
Sticky bool `json:"sticky,omitempty"`
}
// CircuitBreaker holds circuit breaker configuration.