Using HAProxy I'm trying to proxy a site where the URL doesn't match the path of the proxied destination server. Right now I'm able to use
reqrep to edit the path and at my browser I end up fetching the index.html however it doesn't load any of it's support files (.css, .js ext) even though they are listed by reference.
For example www.mysite.com/maps --haproxy--> www.backend-server.com. In my config I remove /maps so we end up at the web-server root of www.backend-server.com and are able to fetch index.html but now when the .css & .js try to load they can't as they are referencing
www.mysite.com/icons/text.gif when I'm guessing they should be referencing
www.mysite.com/maps/icons/text.gif. Also I can't just make a rule saying .css & .js goto somebackend because I have different app's which all have this problem and pull their .js & .css files from different places. How do I do this the right way? Here's my config:
defaults mode http log global option httplog option dontlognull option http-server-close option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 frontend dev bind xxx.xx.x.30:80 option forwardfor except 127.0.0.0/8 #Routing based on Web App acl filebrowser url_beg /maps use_backend dev.maps if maps backend dev.maps option httpclose option forwardfor reqrep ^([^\ ]*\ /)maps[/]?(.*) \1\2 server maps maps.backend-server.com:80 check