Re: Bug in mod_proxy_balancer or just a bad configuration?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alright, now I know why this sounded familiar.

I had a similar case to yours a while ago, I searched for it and
luckily found it, what I realized at that time is the Header directive
applies generally, so it is not constrained by the proxy tags (not
sure if this is intended or the examples of use case in the docs are
just place there inside the Proxy tags for homogeneous reasons, I
believe the latter is the case) but IIRC I realized both cookies of
the two balancers I defined were being applied at the same time, which
ended up messing the sticky sessions.

So what I did is place the "Header add Set-Cookie..." statements
inside their own Location

So in the fashion of your last example should solve your issues:

<Location /goog>
Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
</Location>

<Location /good>
Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGED
</Location>

Hope this helps.

El jue, 17 jun 2021 a las 0:01, Nick Folino (<nick@xxxxxxxxx>) escribió:
>
> Any thoughts on this before I post a bug report?
>
> On Tue, Jun 15, 2021 at 9:07 PM Nick Folino <nick@xxxxxxxxx> wrote:
>>
>> So I changed the config to eliminate the order question:
>>
>> <Proxy "balancer://rz">
>>     Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
>>     BalancerMember http://www.google.com route=01
>>     BalancerMember http://www.yahoo.com route=02
>>     ProxySet stickysession=RZROUTEID
>> </Proxy>
>> <Proxy "balancer://rz2">
>>     Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
>>     BalancerMember http://www.fox.com route=03
>>     BalancerMember http://www.cnn.com route=04
>>     ProxySet stickysession=RZ2ROUTEID
>> </Proxy>
>>
>> ProxyPass "/goog"  "balancer://rz/"
>> ProxyPassReverse "/goog"  "balancer://rz/"
>> ProxyPass "/good"  "balancer://rz2/"
>> ProxyPassReverse "/good"  "balancer://rz2/"
>>
>> going to http://myserver/goog redirects to the Google page and a set-cookie RZROUTEID=.01
>> going to http://myserver/good redirects to Fox and a set-cookie RZ2ROUTEID=.03 and a second set-cookie for RZROUTEID=.03
>>
>> going back to http://myserver/goog redirects to Yahoo and dets a set-cookie RZROUTEID=.02
>>
>> Nick
>>
>> On Tue, Jun 15, 2021 at 7:57 PM Nick Folino <nick@xxxxxxxxx> wrote:
>>>
>>> I thought that too, but if the rz proxypass was catching all traffic for rz2, then I wouldn't expect any traffic to get to rz2.
>>> But traffic does go to rz2 and all of that works, except it resets the rz route cookie.
>>>
>>> On Tue, Jun 15, 2021 at 3:27 PM Daniel Ferradal <dferradal@xxxxxxxxxx> wrote:
>>>>
>>>> If I am looking at it correctly the order of the ProxyPass directives you defined is not the correct one, /sz defined first would be overriding /sz2. So sz2 should be defined first.
>>>>
>>>> Perhaps that's why you are getting wrong values ? (Browser cache or similar?)
>>>>
>>>> El mar., 15 jun. 2021 19:00, Nick Folino <nick@xxxxxxxxx> escribió:
>>>>>
>>>>> I ran into an interesting situation with cookies being reset in balancers.
>>>>> I couldn't find any documentation on whether numbers are allowed in balancer names.
>>>>>
>>>>> I have this config:
>>>>>
>>>>>    <Proxy balancer://rz>
>>>>>       Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
>>>>>       BalancerMember ajp://server1 route=01
>>>>>       BalancerMember ajp://server2 route=02
>>>>>       ProxySet stickysession=RZROUTEID
>>>>>    </Proxy>
>>>>>
>>>>>    <Proxy balancer://rz2>
>>>>>       Header add Set-Cookie "RZ2ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
>>>>>       BalancerMember ajp://server3 route=03
>>>>>       BalancerMember ajp://server4 route=04
>>>>>       ProxySet stickysession=RZ2ROUTEID
>>>>>    </Proxy>
>>>>>
>>>>> ProxyPass /rz balancer://rz/rz
>>>>> ProxyPass /rz2 balancer://rz2/rz2
>>>>>
>>>>>
>>>>> All works as expected when going to http://myhost/rz
>>>>> I get the RZROUTEID cookie set to 01 or 02 on first hit and it stays set.
>>>>>
>>>>> If I then go to http://myhost/rz2 I get the RZ2ROUTEID set to 03 or 04 but also another cookie set for RZROUTE with the same value as the RZ2ROUTEID cookie.
>>>>>
>>>>> This causes an issue when going back to /rz as the RZROUTEID cookie is now invalid and gets reset based on the balancing rules.
>>>>>
>>>>> I solved the problem by renaming the rz2 balancer to a new name with a digit.
>>>>> Is this by design that digits cause problems in balancer names?  or is this a bug?
>>>>>
>>>>> Nick
>>>>>


-- 
Daniel Ferradal
HTTPD Project
#httpd help at Libera.Chat

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux