Mailing List Archive

Bug in mod_proxy_balancer or just a bad configuration?
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
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
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@folino.us> 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
>
>
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
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@apache.org>
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@folino.us> 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
>>
>>
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
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 <http://www.google.com> route=03
BalancerMember http://www.cnn.com <http://www.yahoo.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@folino.us> 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@apache.org>
> 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@folino.us> 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
>>>
>>>
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
Any thoughts on this before I post a bug report?

On Tue, Jun 15, 2021 at 9:07 PM Nick Folino <nick@folino.us> 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 <http://www.google.com> route=03
> BalancerMember http://www.cnn.com <http://www.yahoo.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@folino.us> 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@apache.org>
>> 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@folino.us> 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
>>>>
>>>>
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
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@folino.us>) escribió:
>
> Any thoughts on this before I post a bug report?
>
> On Tue, Jun 15, 2021 at 9:07 PM Nick Folino <nick@folino.us> 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@folino.us> 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@apache.org> 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@folino.us> 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@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
Daniel,

Thanks for the info. Not sure if that applies here. I have a couple dozen
balancers configured in that virtual. They all work as expected (they
don't mess with each other's cookies) with the exception of the rz and rz2
balancer names. And it's only rz2 that sets itself and the rz cookie. rz
doesn't reset rz2. It appears that either numbers aren't supported in
balancer names, or there's a bug when using numbers.

Not a major problem for me as I just renamed the rz2 balancer and the
problem is solved. If it is a bug it would probably not be seen very
often. I'm gonna play around with it some more to see if I can get a
better understanding of when it occurs, or if this is the only scenario
where it happens.

Nick

On Thu, Jun 17, 2021 at 3:02 AM Daniel Ferradal <dferradal@apache.org>
wrote:

> 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@folino.us>) escribió:
> >
> > Any thoughts on this before I post a bug report?
> >
> > On Tue, Jun 15, 2021 at 9:07 PM Nick Folino <nick@folino.us> 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@folino.us> 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@apache.org>
> 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@folino.us> 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@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
Hi Daniel,

How do you monitor this, but looking at the request Cookie header sent
by the browser or the Set-Cookie sent by httpd?

>> >>
>> >> <Proxy "balancer://rz">
>> >> Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

What if you configure "path=/rz" here ...

>> >> 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

And "path=/rz2" here ?

>> >> BalancerMember http://www.fox.com route=03
>> >> BalancerMember http://www.cnn.com route=04
>> >> ProxySet stickysession=RZ2ROUTEID
>> >> </Proxy>


Regards;
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
On Fri, Jun 18, 2021 at 10:35 AM Yann Ylavic <ylavic.dev@gmail.com> wrote:
>
> Hi Daniel,

Hi Nick, sorry.. (Hi Daniel too though!)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Bug in mod_proxy_balancer or just a bad configuration? [ In reply to ]
Yann,

We found it by user complaints. Digging into the complaints, it was
determined by watching the headers what was happening. Then just a lucky
guess as to why it was happening helped us resolve it.

Nick

On Fri, Jun 18, 2021 at 4:36 AM Yann Ylavic <ylavic.dev@gmail.com> wrote:

> Hi Daniel,
>
> How do you monitor this, but looking at the request Cookie header sent
> by the browser or the Set-Cookie sent by httpd?
>
> >> >>
> >> >> <Proxy "balancer://rz">
> >> >> Header add Set-Cookie "RZROUTEID=.%{BALANCER_WORKER_ROUTE}e;
> path=/" env=BALANCER_ROUTE_CHANGED
>
> What if you configure "path=/rz" here ...
>
> >> >> 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
>
> And "path=/rz2" here ?
>
> >> >> BalancerMember http://www.fox.com route=03
> >> >> BalancerMember http://www.cnn.com route=04
> >> >> ProxySet stickysession=RZ2ROUTEID
> >> >> </Proxy>
>
>
> Regards;
> Yann.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>