Hi, On Thu, Feb 04, 2010 at 10:31:03PM +0100, Holger Just wrote: > On 2010-02-04 21:15, Sriram Chavali wrote: > > I am trying to rewrite URLs using haproxy's reqirep directive. The url that > > I am trying to rewrite is of the pattern > > /action/register?param1=foo¶m2=bar¶m3=baz > > > > The URL that I want to be rewritten is > > /newaction?param1=foo¶m2=bar¶m3=baz on the condition that whenever > > param2=bar > > > > The ordering of the query string parameters can be random, i.e param2 could > > be the 1st parameter or the last one. > > In Haproxy 1.3.x it is currently not possible to issue a reqirep on a > conditional basis. This is however introduced in Haproxy 1.4-rc1. There > you could solve your problem using something like this: > > acl baz url_sub ¶m2=bar ?param2=bar > reqirep ([^\ ]*)\ /action/register\?(.*) \1\ /newaction\?\2 if baz
Well, since both entries are on the same line and param2 is always after the string to match, you can still write it without ACLs in 1.3 : reqrep ([^\ ]*)\ /action.register\?([^&]*&)*param2=bar(.*) \1\ /newaction\?\2param2=bar\3 That way the regex will only match when "param2=bar" appears in one of the parameters. Willy

