Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache ProxyPassReverseCookiePath does not work on second application instance

I have two equal web app instances in Tomcat which are made available by Apache's Reverse Proxy. The first one works just fine but the second one has a problem with getting data from the session (null pointer exception). The ProxyPassReverseCookiePath is apparently configured wrong.

Here is my configuration:

<IfModule proxy_module>
<IfModule proxy_http_module>

#
# Reverse Proxy
#
ProxyRequests Off

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /app1/ http://localhost:8080/localapp1/
ProxyPassReverse /app1/ http://localhost:8080/localapp1/
ProxyPassReverseCookiePath /localapp1 /app1/


ProxyPass /app2 http://localhost:8080/app2
ProxyPassReverse /localapp2 http://localhost:8080/app2
ProxyPassReverseCookiePath /app2 /app2


<Location /app1/ >
RequestHeader edit X-GWT-Module-Base ^(.*)/app1/(.*)$ $1/localapp1/$2
</Location>


<Location /app2 >
RequestHeader edit X-GWT-Module-Base ^(.*)/app2(.*)$ $1/app2$2
</Location>

</IfModule>
</IfModule>

I wanted for the second one to be accesible without the need of a slash ("/") at the end of the URL. I really can't figure out what is wrong here, hope someone can help.

like image 804
user1854278 Avatar asked Jul 13 '26 06:07

user1854278


1 Answers

Is the following configuration what you really want?

ProxyPass /app2 http://localhost:8080/app2
ProxyPassReverse /localapp2 http://localhost:8080/app2
ProxyPassReverseCookiePath /app2 /app2

The proxyPass and ProxyPassReverse configurations don't match. Based on localapp1, your back-end path should probably be localapp2. The following makes more sense to me at an initial glance:

ProxyPass /app2 http://localhost:8080/localapp2
ProxyPassReverse /app2 http://localhost:8080/localapp2
ProxyPassReverseCookiePath /localapp2 /app2
like image 154
McVeigh Avatar answered Jul 15 '26 18:07

McVeigh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!