Last active
September 24, 2021 10:22
-
-
Save michimau/80da3b60a6309f56520570cd025fd699 to your computer and use it in GitHub Desktop.
haproxy.cfg
This file contains hidden or 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
| defaults | |
| timeout connect 5s | |
| timeout client 1m | |
| timeout server 1m | |
| frontend http_front | |
| bind *:80 | |
| mode http | |
| acl app1 path_beg -i /nginx | |
| acl app2 path_beg -i /apache | |
| default_backend http_back | |
| use_backend srvs_nginx if app1 | |
| use_backend srvs_apache if app2 | |
| ######redirect mode###### | |
| #backend srvs_nginx | |
| # mode http | |
| # option forwardfor | |
| # redirect location http://localhost:82 | |
| # | |
| #backend srvs_apache | |
| # mode http | |
| # option forwardfor | |
| # redirect location http://localhost:81 | |
| # | |
| ######proxy mode###### | |
| backend srvs_nginx | |
| mode http | |
| option forwardfor | |
| http-request set-uri %[url,regsub(^/nginx,/,)] | |
| #if { path_beg /nginx } | |
| server server1 nginx:80 | |
| backend srvs_apache | |
| mode http | |
| option forwardfor | |
| http-request set-uri %[url,regsub(^/apache,/,)] | |
| #if { path_beg /apache } | |
| server server2 apache:80 | |
| backend http_back | |
| #balance roundrobin | |
| balance leastconn | |
| mode http | |
| option forwardfor | |
| server server1 nginx:80 | |
| server server2 apache:80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment