HAProxy community

Append prefix to backend


The application listens on When you hit this URL , it prompts for login , now the URL changes to After login , it changes URL back to as you are logged in .

Now , I have HAPROXY configured on another server and want users to use the Jenkins app by hitting the HAPROXY URL .Likewise I have other systems too , that needs to use a single URL but with prefix switching .
So I have frontend /JMaster configured to redirect calls to actual server.
I use it like this haproxyip/JMaster .

frontend http-in
 bind *:80
 option http-server-close
 option forwardfor
 acl has_jenkins path_beg /JMaster
 use_backend jenkins_server if has_jenkins
 default_backend jenkins_server

backend jenkins_server
 balance roundrobin
 reqrep ^([^\ ]\ /)JMaster[/]?(.) \1\2
 server ws2

After hitting the login page , it changes the URL to HAPROXYip/login which is 404 not found


This needs to be tackled from application which I figured out later , The application needs to have context path set to /JMaster , then remove
reqrep ^([^\ ]\ /)JMaster[/]?(.) \1\2
which resolves the issue