Why does haproxy path_beg only work if I donโ€™t visit the site by default?

I configured haproxy to redirect the "/ rawman" path to port 8080 on my server. It works for the first time, but as soon as I visit the default site, it stops working. The default site runs on apache with mod_rewrite, and it breaks invalid requests (using codeigniter), so instead of viewing the redirected site when I am http://mysite.com/rawman?foo=bar I see the default site.

This is my haproxy config: global log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 4096 user haproxy group haproxy daemon defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 frontend http_proxy bind 0.0.0.0:8090 acl is_ast path_beg /rawman use_backend ast if is_ast default_backend mysite backend ast server ast 0.0.0.0:8080 backend mysite server local 0.0.0.0:80 
+6
source share
1 answer

Try setting option httpclose after srvtimeout line.

If you do not, haproxy uses the keepalive setting of the destination server. After you go to the main site, the connection opens and remains open, and on the next request, haproxy goes . Oh, it's not so nice: I have an open connection. Let's just use it , although it shouldn't. Using the httpclose parameter, it always closes the connection, ensuring that every new request uses the correct connection.

I lost 3 hours of my life finding out.

+29
source

Source: https://habr.com/ru/post/889580/


All Articles