I would reinforce the point Willy is making regarding syntax. URLs contain
characters that are part of the regex metacharacter set. It is very easy to
overlook this and resulting expressions will work...most of the time.

I think an example can be found in the documentation. There is a section
containing an example "Example: move the login URL only to HTTPS.". The
example contains the following regex definition:

        acl uid_given  url_reg   /login?userid=[^&]+

I suspect the intent is more accurately represented by:

        acl uid_given  url_reg   /login[?]userid=[^&]+

This assumes that POSIX extended regex are being used. There is only one
reference I've come across in the documentation that actually specifies
which of the several regex variants is being used. Perhaps Willy can
confirm?

Cheers
Andrew

-----Original Message-----
From: Willy Tarreau [mailto:[email protected]] 
Sent: Monday, 8 March 2010 6:07 PM
To: Praveen Patnala
Cc: [email protected]
Subject: Re: Question on URL based load balancing

On Sun, Mar 07, 2010 at 11:25:07PM -0800, Praveen Patnala wrote:
> Willy,
> 
> The value of the type parameter is a regular expression where "xxx" or
"yyy"
> is a substring of the value. So, following url should match acl_xxx :
> /test?type=abcdxxxygg

Ah OK, that was not clear at all.

> How do I specify that in the acl rule?

well, simply "type=[a-z]*xxx[a-z]*" ?
However, be careful about your syntax, because you surely won't want
your acl_xxx rule to match "type=yyyyxxxzzz" which maybe should have
matched "acl_yyy". You must first know the common and specific parts
of your parameters before writing reliable regexs.

Willy



Reply via email to