I often use site like that :
http://www.rexv.org/ to validate pcre regex. This and many other and also other tutorial use escape for "/" character. I do not know how haproxy interpret "/" special character. Your help is appreciated about haproxy pcre standard and interpretation ! In reality the match part for used for acl, I think, can be done also only with "aps_ass_UNIQUE_web1_" part. I think this mach path_reg "http://<mydomain>/app1/aps_ass_UNIQUE_web1_<http://%3cmydomain%3e/app1/aps_ass_UNIQUE_web1_>" for example, I'm Wrong ? The problem is that none of this regex, also your regex, do the work... the request is not routed on the webX specified in the URL. So no cookie insertion is done with the correct backend server name. i.e. If I use http://<mydomain>/app1/aps_ass_UNIQUE_web1_ haproxy does not redirect to the correct backend server web1... I do not know if this is correct, if there is another method, if the reqirep changing the URL can invalidate other step in the process, or other.. Can you tell me more ? Thank you Roberto -----Original Message----- From: Conrad Hoffmann [mailto:[email protected]] Sent: mercoledì 29 luglio 2015 15.18 To: mlist; [email protected] Subject: Re: use_server 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_<http://%3cmydomain%3e/app1/aps_ass_UNIQUE_web1_> > web4 if in the URL haproxy find " aps_ass_UNIQUE_web4_" -> ex: > http://<mydomain>/app1/aps_ass_UNIQUE_web4_<http://%3cmydomain%3e/app1/aps_ass_UNIQUE_web4_> > web4 if in the URL haproxy find " aps_ass_UNIQUE_web10_" -> ex: > http://<mydomain>/app1/aps_ass_UNIQUE_web10_<http://%3cmydomain%3e/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]<mailto:[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<https://%3chostname>>, 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 -- Il messaggio e' stato analizzato alla ricerca di virus o contenuti pericolosi da MailScanner, ed e' risultato non infetto.

