How to make HAProxy path use backend (including links/scripts)?
Hi, I have setup HAProxy so that https://abc.xyz.com/test points to backend http://def.xyz.com.
acl small var(txn.txnpath) -m beg -i /test http-request set-path / if small
At the root level this works but links/images/scripts fail. Do I need to set something up on the backend to add '/test' into the links? If so, how do I do it?
@jonathan-young said in How to make HAProxy path use backend (including links/scripts)?:
At the root level this works but links/images/scripts fail. Do I need to set something up on the backend to add '/test' into the links?
What do the requests at the backend look like? If the /test is missed you have to configure HAproxy to add it in the backend settings.
@viragomann Thanks for replying. The logs show:
Mar 1 21:21:47 pfsense haproxy: 10.1.1.50:49456 [01/Mar/2023:21:21:47.545] test~ test/<NOSRV> -1/-1/-1/-1/0 503 565 - - SC-- 4/4/0/0/0 0/0 "GET /50021701/images/image1_hp.gif HTTP/1.1"
which is a blank icon. So I think I need something on the backend that will change the GET to:
"GET /test/50021701/images/image1_hp.gif HTTP/1.1"
but I am at a bit of loss how to write the script or where to put it exactly.
Just to be clear. Backend website def.xyz.com/index.html contains an image at /50021701/images/image1_hp.gif which I want to be displayed (along with everything else in the page) when I navigate to https://abc.xyz.com/test
Thanks for the help.
You can do something like this to insert the /test directory:
In the backend add an ACL:
path starts with