Bug 62998 - Mod_proxy not working
Summary: Mod_proxy not working
Status: UNCONFIRMED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.5-HEAD
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-10 15:24 UTC by Vipin Pillai
Modified: 2018-12-11 07:36 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vipin Pillai 2018-12-10 15:24:09 UTC
Hi There,

Below is my configuration 

ProxyRequests On

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; Path=/; HttpOnly" env=BALANCER_ROUTE_CHANGED

<Proxy "balancer://TomcatCluster">

BalancerMember "ajp://abc.com:8009" route=worker1 KeepAlive=On

BalancerMember "ajp://xyz.com:8009" route=worker2 KeepAlive=On

ProxySet stickysession=JSESSIONID|ROUTEID

ProxySet lbmethod=bybusyness

</Proxy>

ProxyPass / "balancer://TomcatCluster/"

ProxyPassReverse / "balancer://TomcatCluster/"

#ProxyPassReverseCookiePath balancer://TomcatCluster/ /

ProxyTimeout 1200000

KeepAlive On

KeepAliveTimeout 60

MaxKeepAliveRequests 100


My Sticky session is not working,when checked in logs found BALANCER_SESSION_STICKY and BALANCER_SESSION_ROUTE in access logs

[10/Dec/2018:15:15:15 +0000];GET /biprws/internal/v1/user/disclaimer/Ac7UIwmYafpFuhiiw6FRXLQ?pagesize=50&_=1544454912098 HTTP/1.1;200;18;https://loadbalancer.com/BOE/portal/1810011833/FioriBI/main.jsp?service=%2Fcommon%2FappService.do&appKind=InfoView;Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko;-;.worker2;-;-;worker2



Below is my Apache version

Server version: Apache/2.4.9 (Win64)
Apache Lounge VC10 Server built:   Mar 17 2014 12:11:31


Please help
Comment 1 Eric Covener 2018-12-10 15:26:43 UTC
You didn't show any headers or logs and your build is nearly 5 years old.
Comment 2 Ruediger Pluem 2018-12-10 20:04:24 UTC
Your configuration is wrong. You look in the JSESSIONID cookie for the routing information not in the ROUTEID cookie.
See stickysession at http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass
Comment 3 Vipin Pillai 2018-12-11 04:26:20 UTC
HI ERIC and Ruediger,

Thanks for your inputs.

I have changed configuration to 

ProxyRequests On

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; Path=/; HttpOnly" env=BALANCER_ROUTE_CHANGED

<Proxy "balancer://TomcatCluster">

BalancerMember "ajp://abc.com:8009" route=worker1 KeepAlive=On

BalancerMember "ajp://xyz.com:8009" route=worker2 KeepAlive=On

ProxySet stickysession=ROUTEID

ProxySet lbmethod=bybusyness

</Proxy>

ProxyPass / "balancer://TomcatCluster/" stickysession=ROUTEID

ProxyPassReverse / "balancer://TomcatCluster/"

#ProxyPassReverseCookiePath balancer://TomcatCluster/ /

ProxyTimeout 1200000

KeepAlive On

KeepAliveTimeout 60

MaxKeepAliveRequests 100

and I have set log format iin httpd.conf as below

LogFormat "%h;%t;%r;%>s;%b;%{Referer}i;%{User-Agent}i;%{JSESSIONID}C;%{ROUTEID}C;%{BALANCER_SESSION_STICKY}e;%{BALANCER_SESSION_ROUTE}e;%{BALANCER_WORKER_ROUTE}e" accessLog

Still the issues is same and in logs I am getting same issues for ROUTEID

<ip>;[11/Dec/2018:04:18:32 +0000];GET /biprws/internal/v1/settings/userpreferences/pagepreferences?pagesize=50&_=1544501910008 HTTP/1.1;200;114;https://loadbalancer.com /BOE/portal/1810011833/FioriBI/main.jsp?service=%2Fcommon%2FappService.do&appKind=InfoView;Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko;-;.worker2;-;-;worker2

For JESSIONID and getting proper values for BALANCER_SESSION_STICKY and  BALANCER_SESSION_ROUTE in logs as below

<ip>;[11/Dec/2018:04:18:31 +0000];GET /BOE/portal/1810011833/FioriBI/i18n/fioribiResources_en_GB.properties HTTP/1.1;404;2497;https://loadbalancer.com/BOE/portal/1810011833/FioriBI/main.jsp?service=%2Fcommon%2FappService.do&appKind=InfoView;Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko;E6B65125A368F523379AE2DE134F4B1C.worker1;.worker2;JSESSIONID;worker1;worker1


Let me know if I am missing something or need any other logs

Please help

Regards,

Vipin
Comment 4 Ruediger Pluem 2018-12-11 07:36:28 UTC
(In reply to Vipin Pillai from comment #3)
> HI ERIC and Ruediger,
> 
> Thanks for your inputs.
> 
> I have changed configuration to 
> 
> ProxyRequests On
> 
> Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; Path=/; HttpOnly"
> env=BALANCER_ROUTE_CHANGED
> 
> <Proxy "balancer://TomcatCluster">
> 
> BalancerMember "ajp://abc.com:8009" route=worker1 KeepAlive=On
> 
> BalancerMember "ajp://xyz.com:8009" route=worker2 KeepAlive=On
> 
> ProxySet stickysession=ROUTEID
> 
> ProxySet lbmethod=bybusyness
> 
> </Proxy>
> 
> ProxyPass / "balancer://TomcatCluster/" stickysession=ROUTEID
> 
> ProxyPassReverse / "balancer://TomcatCluster/"
> 
> #ProxyPassReverseCookiePath balancer://TomcatCluster/ /
> 
> ProxyTimeout 1200000
> 
> KeepAlive On
> 
> KeepAliveTimeout 60
> 
> MaxKeepAliveRequests 100
> 
> and I have set log format iin httpd.conf as below
> 
> LogFormat
> "%h;%t;%r;%>s;%b;%{Referer}i;%{User-Agent}i;%{JSESSIONID}C;%{ROUTEID}C;
> %{BALANCER_SESSION_STICKY}e;%{BALANCER_SESSION_ROUTE}e;
> %{BALANCER_WORKER_ROUTE}e" accessLog
> 
> Still the issues is same and in logs I am getting same issues for ROUTEID
> 
> <ip>;[11/Dec/2018:04:18:32 +0000];GET
> /biprws/internal/v1/settings/userpreferences/
> pagepreferences?pagesize=50&_=1544501910008
> HTTP/1.1;200;114;https://loadbalancer.com
> /BOE/portal/1810011833/FioriBI/main.jsp?service=%2Fcommon%2FappService.
> do&appKind=InfoView;Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0;
> rv:11.0) like Gecko;-;.worker2;-;-;worker2
> 
> For JESSIONID and getting proper values for BALANCER_SESSION_STICKY and 
> BALANCER_SESSION_ROUTE in logs as below
> 
> <ip>;[11/Dec/2018:04:18:31 +0000];GET
> /BOE/portal/1810011833/FioriBI/i18n/fioribiResources_en_GB.properties
> HTTP/1.1;404;2497;https://loadbalancer.com/BOE/portal/1810011833/FioriBI/
> main.jsp?service=%2Fcommon%2FappService.do&appKind=InfoView;Mozilla/5.0
> (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like
> Gecko;E6B65125A368F523379AE2DE134F4B1C.worker1;.worker2;JSESSIONID;worker1;
> worker1

The logs show that the JSESSIONID cookie is used to extract the routing information and not the ROUTEID cookie. So it is likely that the configuration you supplied above is not the one that was used when the log entries were written.