Hi

Am 07-05-2015 23:07, schrieb Patrick Slattery:

I ended up trying out the new Lua functionality in 1.6 and was able to get this to work with it.

That's cool ;-)

haproxy.cfg
global
lua-load /path/query.lua

[snipp]

I'm just curious if this is the right way to do this in HAProxy?

I'm sure there is more the one way to solve your need.

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

On May 07, 2015, at 10:56 AM, Patrick Slattery <patrickmslatt...@mac.com> wrote:

Hi, I'm trying to figure out how rewrite an incoming query string such as:

http://www.example.com/?domain=companyx.com&sdn=&sid=123456789&sid_guid=d8bfbc1a-c790-4cf8-beec-ffbbf72d9476&k=mystring&strid=1e961&1e961&t=%20?

becomes:

http://shop.companyx.com/shop.aspx?sid=123456789&sid_guid=d8bfbc1a-c790-4cf8-beec-ffbbf72d9476&strid=1e961&shopurl=search.aspx

I can see how to extract each of the query params with urlp(parmname) but I don't see any obvious way of reassembling the query string from the extracted variables. Is this practical in HAProxy (any version) or should I look at using some other tool for this?

Thanks.

Reply via email to