On Fri, May 2, 2014 at 9:48 AM, [email protected] <[email protected]> wrote:

> Maybe I dont't understand you correctly.
>
>
> When I change "http://abc.example.com/?code=1234"; to "
> http://abc.example.com/code=1234 <http://abc.example.com/?code=1234>"  
> everything
> works.
>
> The logic is:
>
> Only redirect to the redirect location if abc.example.com is called
> directly (or with appended slash). Don't redirect if anything is present
> behind the slash (to avoid a redirect loop).
>
>
>

"after the slash" is the problem. The query string isn't considered part of
the *path* so in your case the path of "/" and "/?code=1234" is equal to
"/" in both cases.

Your second case above with the path of "/code=1234" works because it's not
an exact string match of "/".

There are many sources to describe the various parts of a URL including the
haproxy documentation:
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#1.2.1

-Bryan




> P.S.: using HAProxy 1.4.24
>
>
>
> 2014-05-02 18:27 GMT+02:00 Bryan Talbot <[email protected]>:
>
> On Fri, May 2, 2014 at 9:13 AM, [email protected] <[email protected]>wrote:
>>
>>> Hi Bryan,
>>>
>>> same problem with your acl.
>>>
>>>
>>> I think the acl isn't the problem here, i suspect the redirect line.
>>>
>>>
>>>
>>
>> You are redirecting requests for abc.example.com/ to abc.example.com/which 
>> is why you have a loop. Options would be to change the host or path,
>> or check for your query string, or a cookie being set or something to stop
>> the loop.
>>
>>
>>
>> -Bryan
>>
>>
>>  frontend http
>>>>>
>>>>>
>>>>>      acl is_domain hdr_dom(host) -i abc.example.com
>>>>>
>>>>>      acl root path_reg ^$|^/$
>>>>>
>>>>>
>>>>>      redirect location http://abc.example.com/?code=1234  code 301
>>>>> if  is_domain  root
>>>>>
>>>>>
>>>>> Unfortunately this ends up in a redirect loop.
>>>>>
>>>>
>>>>
>>>> All paths begin with "/". I suspect that you don't want path_beg but
>>>> just path for an exact match.
>>>>
>>>>   acl root path /
>>>>
>>>>
>>>>
>>
>>
>

Reply via email to