English Forums > Tutorials and FAQs
How to use haproxy "replace-path" http-request function
(1/1)
myg63:
Hello @all,
I'm using haproxy for several backend pools with ssl offload which is working fine when I use domains which go thru rules into these backends.
Now I want to use the well documented feature of "redirecting" paths.
So for example a request to https://test.domain.com/app1" should be redirected to a backend without the path but still preserving the rest of the path.
It can be used by adding a backend rule "http-request replace-path /xxxx(/)?(.*) /\2" where xxxx is the "virtual" directory
This feature ist documented in https://www.haproxy.com/blog/path-based-routing-with-haproxy
Please can anyone give advice how to use that feature in opnsense's haproxy implementation?
I'm using latest version 23.7.6
Thanks @all in advance from Germany...
myg63:
Does anyone have an Idea?
Monviech:
I wouldn't try to do this. Here is a great explanation on why this is a bad idea:
https://caddy.community/t/the-subfolder-problem-or-why-cant-i-reverse-proxy-my-app-into-a-subfolder/8575
I would rather use subdomains that are called like the app and reverse proxy the entire webroot per app.
"foo.example.com" -> 192.168.1.1:80
"bar.example.com" -> 192.168.1.2:443
... etc...
That will really save you a lot of headache.
Navigation
[0] Message Index
Go to full version