Wow, very nice, regular expressions sure are powerful :-)

Here is what I ended up with:
defaults
 mode http
 timeout connect 1s
 timeout client 1s
 timeout server 1s
listen HTTP-in
 bind 127.0.0.1:80
 reqrep .*(sid=[a-z0-9A-Z]*)&(sid_guid=[^&]*)&.*(strid=[0-9a-zA-Z]*) 
\1&\2&\3&shopurl=search.aspx
 redirect code 301 prefix http://shop.companyx.com/shop.aspx?


curl -i 
"http://localhost/?sid=100026264&sid_guid=342ca0f2-beb0-4132-b188-5f162941bb83";

HTTP/1.1 301 Moved Permanently
Content-length: 0
Location: 
http://shop.companyx.com/shop.aspx/?sid=100026264&sid_guid=342ca0f2-beb0-4132-b188-5f162941bb83
Connection: close


On May 07, 2015, at 05:27 PM, Aleksandar Lazic <[email protected]> wrote:

I would use "reqrep"
https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4-reqrep

Example:
reqrep .*(sid=[a-z0-9A-Z]*)&(sid_guid=[^&]*)&.*(strid=[0-9a-zA-Z]*)
http://shop.companyx.com/shop.aspx?\1&\2&\3&shopurl=search.aspx

I have build the regex with https://regex101.com/

Maybe there is a option to use a more generic way as in lua with.

https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#url_param

BR Aleks


Reply via email to