Full URL redirection: domain + path + query, how do I do it?


I use HAProxy 1.5.14 with CentOS 7.

For a while I have been redirecting stuff using a map file like this:

domain1.com https://somedomain.net/path
domain2.com/path https://somedomain.net/path2?option=10
..and so on..

Then in the frontend I do:

http-request redirect location %[base,map_beg(/etc/haproxy/redirections.map)] code 302 if { base,map_beg(/etc/haproxy/redirections.map) -m found }

And this has been working like a charm, however I’m facing an issue that I do not know how to solve, I have to redirect a few URLs now that contain parameters (domain + path + query) IE:

domain3.com/path?optiona=1&optionb=2 https://yetanotherdomain.net/something?option=10
domain4.oreg/home?lol=1 https://yetanotherdomain.net/something?option=15

I tried using:

http-request redirect location %[url,map_beg(/etc/haproxy/redirections.map)] code 302 if { url,map_beg(/etc/haproxy/redirections.map) -m found }

But it didn’t work.

I have searched on Google up and down right and left and after a week I haven’t been able to find a solution for this issue.

Does any kind soul out there know a way to achieve this?

Thanks in advance.


Hi, no one knows how to do this?

Am I the only one who would ever attempt to do that?

Am I doing something that doesn’t make sense?


Help? no one?

No one knows/have ever tried to do this?