HAProxy rewrite URL

Jenkins listens on 192.168.2.57:9000 . Now my HAPROxy configured on another machine is has been updated with virtual path

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

backend jenkins_server
balance roundrobin
option forwardfor
server jenkins 192.168.2.57:9000

When I hit /jenkins , page come up with BAD REQUEST. The issue is the actual server does not serve with /jenkins. Hence I need to strip /jenkins and send the request to backend . So I did this

reqrep ^([^\ ]*\ /)jenkins[/]?(.*)     \1\2

The page does not load either , but now no BAD REQUEST . Instead I just get blank page , but when I press F12 I can see in the console and the request headers coming up . The URL now in there /css , which is not good as it needs to be 192.168.2.57:9000/css , to make it work .

The links in the page still points to , which is not the actual server where it is hosted and fails subsequently

No, you are confusing path with the URL. The IP address and port are not part of the GET request.

See this grab from Chrome browser console . This is how the links show up when you browse the application using the local IP where it is hosted , hence when you browse usign HAPROXY , it needs to send the request to backend as this , but it replaces with HAPROXYIP

Request URL:http://192.168.2.57:9000/js/vendor.js
Request Method: GET

Here the path is:

/js/vendor.js

which translate to a get request like this:

GET /js/vendor.js HTTP/1.1

Do you need a particular Host header perhaps?

As you see , my calls should translate to the actual application IP . Not sure how that can be done

@lukastribus , any update on the above . I need this to work as reverse proxy

This is a public forum, please remove those credentials immediately for your own safety.

All I can do is suggest haproxy configurations when you know what you configuration/architecture requires.

Since you don’t, I suggest you hire somebody who can or get enterprise support from haproxy.com; but I am unable to troubleshoot your backend applications.

@lukastribus, thanks for reminding,have withdrawn the post.

The application itself does not accept any prefix .It does listen only on port .
But my need is to custom wire URL with a prefix for user.