Redirection with URL masking

Hi,
I am new in Haproxy Load Balancing and i am doing okay in redirecting traffic on two different URLs. But unable to mask URL for client end because all I want is to redirect traffic from test.uv.edu.pk to test1.uv.edu.pk and test2.uv.edu.pk without changing URL at client end so that client could not see the backend URLs.

Some of my configurations are shared below:

frontend test
bind 192.168.128.10:80
acl is_test.uv.edu.pk hdr(host) -i test.uv.edu.pk
use_backend test_backend_servers if is_test.uv.edu.pk
default_backend test_backend_servers
option forwardfor

 backend test_backend_servers
 mode http
 reqrep ^([^\ ]*)\ (.*) \1\ \2
 balance            roundrobin
server             test1 192.168.128.11:80 maxconn 5000 check
server             test2 192.168.128.12:80 maxconn 5000 check

====================================

Regards,
Khuram

You can achieve this by using http-request set-path ... (see the manual). In case of redirects you also need to change the Location header accordingly by using http-response set-header Location ....

However if your actual server generates in the resulting HTML paths that should be “hidden” (and thus rewritten) then HAProxy wouldn’t be able to help you.

I think the best solution is to fix the actual servers into using the proper URL’s else you’ll just create more issues than you are solving.

Hi Khuram,

I am also facing same issue ,redirecting traffic on two different URLs. But unable to mask URL

I want is to redirect traffic from example.com to example1.com and example2.com without changing URL at client end so that client could not see the backend URLs. let me know the solution if you have resolved it