pfSense haproxy - Proxy to subdirectory

I’m in the process of moving from nginx as a reverse proxy to haproxy (one less VM to worry about…).

I want to proxy to a specific URL, not just the server.

In nginx, all I have to do is with nginx is:

location / {
		include proxy_params;
		proxy_pass http://internal_server/subdirectory/;
		allow all;

But, after a weekend of Google University :wink: I still cannot figure out how to do it with haproxy. Does it go in the frontend or backend? I assume that it would be part of the ACL and Actions but everyone knows what assumes means.


HAProxy examines the front end and uses the ACL to match the back end destination.

Thanks @LTS_Tom - I watched the video twice. The multiple servers is working. What I am trying to do is have actually point to www.internal.lan/subsite. It isn’t a 301 redirect (e.g. I don’t want to become - I can get that to work). Rather, I want redirection to be right to the subsite like I have done with nginx.

Did you ever figure this out?

I am trying to do something similar. I want to expose my Apache Guacamole server, but not the tomcat server it runs on.

Right now I have getting me to the Apache Tomcat management page. This is not desired. will get me to the Guacamole login screen as desired. This is good, but I do not want to expose the Apache Tomcat management page.

In nginx, I would just do the proxypass as you show in your original post, but I do not understand HAProxy well enough to make it behave similarly.

No luck despite lots of research via Google University, reading the haproxy docs and many trials using a VM.

I find it strange that you can easily do this using Apache HTTPD or nginx but does not seem possible to do so using haproxy…

I am still hunting for an answer too.

You mentioned that you are able to do a redirect from to How did you do that? I think that would be a sufficient work around for me right now, but I get ERR_TOO_MANY_REDIRECTS every time I try that.

I too am looking for a solution to this. It is stupid simple in NGINX with proxy_pass to whatever internal URL string you want. But HAProxy seems to be only capable of IP:Port.

I haven’t looked in a very long time - in short, I gave up. This should be something simple to implement - Apache HTTPD and NGINX is so easy :cry:

Has anyone been able to solve this? I am looking to do my setup with a bunch of subfolders and am just running into some issues. Any help would be greatly appreciated!

Sorry - I gave up. It should be so simple to do but no joy…

I gave up as well and am just going to use subdomains.

Found this thread as I was looking for a way to accomplish this myself. This exact case is actually described in the documentation. What you’re after is called a path replace, which is one of the actions you can perform with an http request. See the links for details.


  # Add the following to either the frontend or backend to replace the url path
  # The example below prefixes the destination path with /foo
  # prefix /foo : turn /bar?q=1 into /foo/bar?q=1 :
  http-request replace-path (.*) /foo\1