Created
January 12, 2020 11:43
-
-
Save DusteDdk/3bda6534324f5f98bc68827d81577877 to your computer and use it in GitHub Desktop.
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
# Toy example, ha-proxy reversing traffic to two backend servers based on path | |
# Has url rewriting and header modification | |
global | |
debug # uncomment to enable debug mode for HAProxy | |
defaults | |
mode http # enable http mode which gives us layer 7 filtering | |
timeout connect 5000ms # max time to wait for a connection attempt to a server to succeed | |
timeout client 50000ms # max inactivity time on the client side | |
timeout server 50000ms # max inactivity time on the server side | |
backend mainSite | |
http-request set-header Host dusted.dk | |
server main dusted.dk | |
backend recipeSite | |
http-request set-path %[url,regsub(^/vafler/*,/,)] # anything going to this backend needs the URL rewritten to leave out that | |
http-request set-header Host vafler.dk | |
server vafler vafler.dk | |
frontend http | |
bind :80 | |
default_backend mainSite | |
# /vafler lives on a different server | |
acl vaflerPath path_beg /vafler | |
use_backend recipeSite if vaflerPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment