Created
August 15, 2017 18:42
-
-
Save rodrigodev/dc07b92cdb0d6a7f5129568a33aa1cb4 to your computer and use it in GitHub Desktop.
Haproxy subdomain redirect
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
| frontend http-in | |
| mode http | |
| bind FRONTENDIP:80 | |
| default_backend nginx_server_1 | |
| acl nginx_1 hdr_end(host) -i www.xyz.com | |
| acl nginx_2 hdr_end(host) -i abc.xyz.com | |
| acl nginx_path path_beg /abc/ | |
| use_backend nginx_server_1 if nginx_1 !nginx_path | |
| backend nginx_server_1 | |
| server nginx1 10.0.0.1:8080 maxconn 1000 | |
| backend nginx_server_2 | |
| server nginx2 10.0.0.2:8080 maxconn 1000 |
HI @realtebo, this is for reference only, for more details you can look here:
https://serverfault.com/questions/325606/haproxy-subdomain-redirect
Where I got this config from...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank You for this gist.
Can I ask you how will be selected the second server?