Created
October 18, 2018 13:12
-
-
Save ferdinandosimonetti/23d0d9e468314a85d803bf5e2576be4d to your computer and use it in GitHub Desktop.
HAProxy reverse proxy configuration with URL rewriting for two backends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local2 | |
maxconn 2048 | |
tune.ssl.default-dh-param 2048 | |
defaults | |
mode http | |
log global | |
option httplog | |
option dontlognull | |
option http-server-close | |
option forwardfor except 127.0.0.0/8 | |
option redispatch | |
retries 3 | |
timeout http-request 10s | |
timeout queue 1m | |
timeout connect 10s | |
timeout client 1m | |
timeout server 1m | |
timeout http-keep-alive 10s | |
timeout check 10s | |
frontend fe-test | |
bind *:80 | |
acl ac-web1 path_beg /web1 | |
acl ac-web2 path_beg /web2 | |
use_backend be-web1 if ac-web1 | |
use_backend be-web2 if ac-web2 | |
backend be-web1 | |
server static web-a:80 check | |
reqrep ^([^\ :]*)\ /web1[/]?(.*) \1\ /aaa/\2 | |
backend be-web2 | |
server static web-b:80 check | |
reqrep ^([^\ :]*)\ /web2[/]?(.*) \1\ /bbb/\2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ciao Ferdinando,
need an upgrade for using new http-request/http-response features of Haproxy 2.1 :-)
Cheers
Luca