I'm having some troubles replacing a Apache2 reverse proxy rule for a Varnish ACL.
The apache rule is:
<Location /MySite>
ProxyPass http://192.168.0.123/OtherSite
</Location>
My Varnish ACL:
if (req.url ~ "^/(?i)MySite") {
set req.backend = myhost; # 192.168.0.123
set bereq.url = regsub(req.url, "^/(?i)MySite", "/OtherSite");
return (pipe);
}
This is causing the URL on the client side to change to "/OtherSite", which I do not want to happen. On this scenario, when user enters http://www.myhost.com/MySite, the response is redirecting the user's browser to http://www.myhost.com/OtherSite. I want this "redirection" to happen only on varnish back-end request, having the same behavior as Apache's ProxyPass.
How can I achieve this?
Thank you