The problem is that, I have haproxy configured for multiple domains with backends respectively. The intended behaviour is to redirect a specific request such as myfirstdomain.com/alerts
to backend2
and the already configured backend myfirstdomain.com
still configured to provide for backend1
.
Current haproxy.cfg
frontend https_443_frontend
bind *:80
bind *:443 ssl crt build_rupid_in.pem crt code_rupid_in.pem crt artifacts_rupid_in.pem crt prodmon_rupid_in.pem crt prodmondb_rupid_in.pem
acl ACL_backend0 hdr(host) -i myzerodomain.com
use_backend backend_backend0 if ACL_backend0
acl ACL_backend1 hdr(host) -i myfirstdomain.com
use_backend backend_backend1 if ACL_backend1
backend backend_backend0
mode http
server app01 127.0.0.1:9909
backend backend_backend1
mode http
server app02 127.0.0.1:9990
What i tried
ACL_alerts path -i -m alerts
use_backend backend2 if ACL_backend1 ACL_alerts
backend backend2
mode http
server app2 127.0.0.1:9999
What else should I change and please help me in understanding how this works. I guess I need to add http-request replace-path
and http-response replace-something
. I don't know for sure how this works. Please help me resolve this.
haproxy
changed a lot in 10 years.reqrep
isn't supported anymore and replaced byhttp-request replace-uri
. This should help haproxy.com/blog/path-based-routing-with-haproxy