0

I am using IBM HTTP Server (Which use internally Apache Http Server 2.4.) http://docs.motechproject.org/en/latest/deployment/sticky_session_apache.html#:~:text=Sticky%20Session%20is%20a%20method,get%20lost%20across%20application%20instances.

After taking the reference from above selected second approach for doing the sticky session. But found it is not working. Call goes to first server then second.

Below is my configuration.

<VirtualHost *:443>
    ServerName localhost
    ProxyPreserveHost On
    SSLEnable
    SSLProxyEngine on
    ProxyRequests Off
    SSLTrace
    KeyFile "C:/Program Files/IBM/HTTPServer/key.kdb"
    SSLProxyCheckPeerCN off
    
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; Max-Age=60 path=/TestApp" env=BALANCER_ROUTE_CHANGED
    
    <Proxy balancer://MyBalacer>
        BalancerMember "https://10.54.21.35:4001" route=dev_1
        BalancerMember "https://10.54.21.35:4011" route=dev_2
        
        ProxySet lbmethod=bytraffic
        ProxySet stickysession=ROUTEID 
    </Proxy>
    
    <Location /TestApp>
        ProxyPass        balancer://MyBalacer/TestAPI 
        ProxyPassReverse balancer://MyBalacer/TestAPI  
        ProxyPassReverseCookiePath  /TestAPI /TestApp
         
    </Location>
    
</VirtualHost>

Please help me what i am doing the wrong here?

Update:

There is issue in my Cookie creation

Before:

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; Max-Age=60 path=/TestApp" env=BALANCER_ROUTE_CHANGED

After:

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; SameSite=None; path=/TestApp" env=BALANCER_ROUTE_CHANGED

Developer
  • 150
  • 2
  • 12
  • No IBM HTTP Server based on Apache 2.4 includes mod_proxy_balancer. If you want an Apache-based server for mod_proxy, it's best to not repurpose some copy of IBM HTTP Server you have and use a more vanilla distribution of Apache where these modules are actually used and supported. – covener Jun 06 '22 at 17:59
  • I suggest using a command-line client or browser developer tools to make sure the cookie is sent and returned on subsequent requests, then look at what logs are produced at LogLevel debug. – covener Jun 06 '22 at 18:01

0 Answers0