Hi all,

I revive this thread.

Le 12/11/2015 09:59, Igor Cicimov a écrit :


On Thu, Nov 12, 2015 at 6:44 PM, Guillaume Bourque
<guillaume.bour...@logisoftech.com
<mailto:guillaume.bour...@logisoftech.com>> wrote:

    Hi,

    thanks for the suggestion but it did not work for me.   I tried

        acl fr_top                  url_reg                /?lang=
        acl fr_top                  url_reg                /?lang=$
         # off acl fr_top                            urlp_reg(lang\=$,?)
         -m found
         # off acl fr_top                            urlp_reg(lang\=$,?)
         -m found

    but with no luck

I think that using "urlp" should have done the job but that the implementation in haproxy is not correct for one specific case.

Currently, haproxy won't match an url parameter if its value is empty. I tend to think it should : an empty value is different from not providing the parameter at all.

The function "find_next_url_param()" should unconditionally return "1" when a parameter is found, instead of "value_end != value_start" :
http://www.haproxy.org/git?p=haproxy.git;a=blob;f=src/proto_http.c;h=77a52078d0d0d458ed7f0233dfda87eca247d2c2;hb=HEAD#l11661

This would allow some rules like :
    acl LANG_FR_NONE urlp_reg(lang) ^(fr)?$
    acl LANG_EN      urlp(lang) en

    http-request redirect location /    if { path / } LANG_FR_NONE
    http-request redirect location /en  if { path / } LANG_EN


If it's ok for everyone, I can provide a small patch (which will also fix some invalid code comments on top of this function).


--
Cyril Bonté

Reply via email to