Using Haproxy 1.5.12 running on Ubuntu 12.04
My website gets a lot of requests like this one:
http://www.example.com/foo/bar/mypage.php?gallery=&position=3
the correct URL should be:
http://www.example.com/foo/bar/mypage.php?gallery=photogallery&position=3
I've been successful in rewriting requests to the correct URL, but I would also like to issue a 301 redirect to clients.
Following this post: redirect rewritten url using haproxy I tried:
acl fix_gallery url_sub gallery=&
reqrep (.*)gallery=&(.*) \1gallery=photogallery&\2
redirect prefix / code 301 if fix_gallery
Trying to be creative I've tried:
acl fix_gallery url_reg (.*)gallery=&(.*)
acl fix_gallery urlp_reg(gallery) -m str ""
acl fix_gallery urlp_reg(gallery) -m len 0
and many more. But nothing seems to work, so I'm obviously missing something.
Any suggestions?
Thanks