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.

Thanks!

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 www.site.org actually point to www.internal.lan/subsite. It isn’t a 301 redirect (e.g. I don’t want www.site.org to become www.site.org/subsite - 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 guac.mydomain.com getting me to the Apache Tomcat management page. This is not desired.
guac.mydomain.com/guacamole 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 www.site.org to www.site.org/subsite. 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.