HAProxy: How to rewrite url?
-
I would like to rewrite an URL on a specific HAProxy backend like this:
http://firewall/MyPath => http://backend:8080/
So HAProxy should simply remove the MyPath from the url when sending the request to the backend.
My guess is that this should be possible in the "Access Control lists" section, below the "Path starts with" section. There is a + button, but nothing happens when I click on that button.
Is this a bug or am I doing something wrong? -
Look under the 'actions' to configure 'what' to do if a acl is matched. There are only a very few acl's that have extra options under the + button.
-
Look under the 'actions' to configure 'what' to do if a acl is matched. There are only a very few acl's that have extra options under the + button.
Thanks for the hint. I didn't found any action for url rewrite, so I guess I have to write a custom action. But I didn't find any working custom action to to this. I think I would have to use a "http-request set-path" action, but I didn't find any working examples for my rewrite.
Could you please provide an example for a custom action that simply rewrites the url path from /MyPath to /?
Edit: I found a working action. I've added this to the backend:
reqrep ^([^\ ])\ /MyPath/(.) \1\ /\2