Hi,

On 07/29/2015 01:07 PM, mlist wrote:
> We have 3 backend servers balanced with haproxy with "cookie insert" option 
> and ssl redirection.
> For our help desk, we need operators can access a specific backend server to 
> check specific server when we have problems on this backend server.
> 
> We try to do that with the following section, so no hosts file nor DNS 
> mapping and special binding on backend servers are needed to access specific 
> backend server, maintaining the right cookie after use_server.
> 
> We have 3 backend servers: web1, web4 and web10. We want to go on:
> web1 if in the URL haproxy find " aps_ass_UNIQUE_web1_"  -> ex: 
> http://<mydomain>/app1/aps_ass_UNIQUE_web1_
> web4 if in the URL haproxy find " aps_ass_UNIQUE_web4_"  -> ex: 
> http://<mydomain>/app1/aps_ass_UNIQUE_web4_
> web4 if in the URL haproxy find " aps_ass_UNIQUE_web10_"  -> ex: 
> http://<mydomain>/app1/aps_ass_UNIQUE_web10_
> 
> Following configuration does not work, can you help to identify a solution ?
> 
>    acl aps_ass_web1 path_reg (.*)\/aps_ass_UNIQUE_web1_(.*)

I don't think the "/" should be escaped, so basically just:

acl aps_ass_web1 path_reg (.*)/aps_ass_UNIQUE_web1_(.*)

Also, while I am not really an expert on this, I think this is a pretty
expensive regex, since the .* will initially match the whole path, then has
to back-search to match the end. If the path pattern is always like the one
you mentioned above you might be better off with something like
(/[^/]+)/aps_ass_UNIQUE_web1_(.*) (that's off the top of my head, no
guarantees for correctness). Might not be worth worrying about if you don't
have performance issues, though.

Hope that helps,
Conrad


>    acl aps_ass_web4 path_reg (.*)\/aps_ass_UNIQUE_web4_(.*)
>    acl aps_ass_web10 path_reg (.*)\/aps_ass_UNIQUE_web10_(.*)
>    reqirep (.*)\/aps_ass_UNIQUE_web[0-9]*_(.*)     \1\2
>    use-server web1 if aps_ass_web1
>    use-server web4 if aps_ass_web4
>    use-server web10 if aps_ass_web10
> 
> Thank you.
> 
> Roberto
> 
> 
> -----Original Message-----
> From: Cyril Bonté [mailto:[email protected]] 
> Sent: martedì 28 luglio 2015 10.24
> To: mlist
> Cc: [email protected]
> Subject: Re: Regex
> 
> Hi again,
> 
> On 28/07/2015 09:42, mlist wrote:
>>
>> I wrote in the first mail I used 2 different regex. The (1) probably doesn't 
>> match, but the (2) ?
>>
>>> (2) reqirep (.*)\/demoj(.*)     \1/DemoJ\2
>>
>> This regex match https://<hostname>, I'm Wrong ?
> 
> Good news for you, at this step, no, you are perfectly right (except 
> that there is an unneeded antislash before /demoj).
> 
> And I realize that you are also right about something unclear in the 
> documentation : headers transformations only apply when the request line 
> doesn't match. This is quite well documented in the code, not in the 
> documentation... Here comes the confusion on your side and mine.
> 
> This means that whatever you do, if your request line contains "/demoj"
> a regex like (.*)/demoj(.*) will never apply to headers.
> You have to sepcify 2 different regex which will ensure that will match 
> only one case at a time (request line OR headers).
> 
> But I still don't understand why you want to modify the referer.
> 

-- 
Conrad Hoffmann
Traffic Engineer

SoundCloud Ltd. | Rheinsberger Str. 76/77, 10115 Berlin, Germany

Managing Director: Alexander Ljung | Incorporated in England & Wales
with Company No. 6343600 | Local Branch Office | AG Charlottenburg |
HRB 110657B

Reply via email to