Hi Igor, On Wed, Jun 18, 2014 at 01:10:25PM -0700, Igor Serebryany wrote: > Hi! > > I am trying to figure out what the effect of adding the `cookie` option to > a `server` config line is. According to this chunk of documentation: > > https://cbonte.github.io/haproxy-dconv/configuration-1.4.html#5-cookie > > "This value will be checked in incoming requests, and the first > > operational server possessing the same value will be selected." > > However, doesn't this require me enabling a cookie load balancing > algorithm?
A cookie "persistence" method, not load balancing. Cookie provides the exception to load balancing : if a cookie is found, then no load balancing happens and the correct server is picked instead. But you're right, you need to set a "cookie" directive. I'm used to use this : cookie SRV insert indirect nocache > What I mean is, if I don't explicitly set any load balancing > algorithm and the default (roundrobin) is chosen, it seems as though > setting the cookie actually as no effect. That's true. In the past we used to reject such a configuration, but recently we relaxed the check because there was no other way to keep the per-server cookie values when temporarily disabling cookie persistence for debugging or whatever. So now such a configuration is perfectly valid but the cookie is never looked up. > In fact, setting the cookie should have no effect unless I specify > `appsession`, `cookie`, or `balance uri` (or one of the other persistent > `balance` algorithms) in a backend. Is that correct? No, it's unrelated to the balancing algorithms nor to appsessions, it's only used by the "cookie" directive. Hoping this helps, Willy