Hi Adrian,

Le 21/02/2013 21:49, Adrian C. a écrit :
Hello, I'm trying to disable session persistence unless an ACL is
matched, let's say like this:

backend proxy1
     mode http
     balance roundrobin
     #
     acl backendmon url_dom foo.bar
     ignore-persist unless backendmon
     cookie BESERVER insert indirect nocache
     #
     server virt00 10.30.1.10:80 check cookie virt00
     server virt01 127.0.0.1:80  check cookie virt01

My first intention not to have persistence on domains other than
"foo.bar" seems fine, no BESERVER cookie inserted: curl -I 
http://www.bar.foo/index.html

But when I do provide my own cookie, I can see I'm being load balanced
in roundrobin: curl -I -b "BESERVER=virt01" http://www.foo.bar/index.html


Could you point out which ignore-persist sentence in the manual I failed
to comprehend? Thanks!

This is because url_dom is designed to match the domain specified in HTTP proxy requests like :
GET http://foobar/ HTTP/1.1
...

What you want is to match the domain specified in the "Host" header. You can use one of the hdr* acls.

Example :
    acl backendmon hdr(Host) -i foo.bar

This will match requests like :
GET / HTTP/1.1
Host: foo.bar

Also when using layer7 acls, don't forget to use "option httpclose" or "option http-server-close", otherwise the acls will only match the first request of a HTTP keepalive connection.

Hope this helps.

--
Cyril Bonté

Reply via email to