I have Jenkins running on Tomcat with HAProxy as a reverse proxy in front of it. That works kind of OK and my
haproxy.conf is listet at the end of my post, but I have a problem with rewriting paths in the response.
GET ht.tp://192.168.1.16/jenkins I get the correct HTML returned, but all links are absolute to the host’s root, and thus my webbrowser cannot fetch them as it tries e.g. ht.tp://192.168.1.16/static/style.css instead of ht.tp://192.168.1.16/jenkins/static/style.css.
If only it was a matter of rewriting domains, I would be home safe, but because of that pesky start o the path I am stuck.
I have tried to change the server and/or host to ht.tp://192.168.1.16/jenkins as in the configuration file below.
Can what I want be one?
How? Any pointers and hints are appreciated. (I tried setting the JENKINS_URL in the jenkins control panel, which didn’t work. Also a generic solution would be convenient.)
I am running HA-Proxy version 1.6.6 2016/06/26
global maxconn 4096 defaults log global maxconn 2000 mode http option redispatch option forwardfor option http-server-close retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout check 10s frontend http-in bind *:80 reqadd X-Forwarded-Proto:\ http acl is_MyWebApp path_beg /MyWebApp use_backend MyWebApp if is_MyWebApp backend MyWebApp option httpclose option forwardfor http-response set-header Location ht.tp://192.168.1.16/MyWebApp http-response set-header Server ht.tp://192.168.1.16/MyWebApp http-response set-header Host ht.tp://192.168.1.16/MyWebApp reqrep ^([^\ ]*\ /)MyWebApp[/]?(.*) \1\2 server s2 192.168.1.16:8080 maxconn 32