Cookies path rewrite

Ondrej Jombik nepto at platon.sk
Mon Jan 5 00:35:59 MSK 2009


We used solution, which reset all the cookie paths to simple '/'

It can be configured in Tomcat with:

     emptySessionPath="true"

So whole directive:

     <Connector port="8080" protocol="HTTP/1.1"
         connectionTimeout="20000"
         redirectPort="8443"
         emptySessionPath="true" />

But I would like to see better solution than this.

Ondrej

On Wed, 31 Dec 2008, Mark James wrote:

> Ondrej Jombik wrote:
>
>> One type of our usage is to serve Tomcat 5.5 applications on specified
>> desired domains. For example:
>> 
>> www.example.com <--[nginx]--> http://tomcat-server.platon.sk:8180/AppDir/
>> 
>> This works great, however we need to use rewrite this way for removing
>> /AppDir/ from links, FORM actions and so on:
>> 
>> server {
>>     listen 80;
>>     server_name www.example.com;
>>     rewrite ^/AppDir/(.*) /$1;
>>
>>     location / {
>>             proxy_pass  http://tomcat-server.platon.sk:8180/AppDir/;
>>     }
>> }
>> 
>> This also works great, however when application set up PATH in cookie,
>> in example cookie like this is sent:
>> 
>> Set-Cookie: JSESSIONID=4961D9D7519835620F9E6D0622F69ECA; Path=/AppDir
>> 
>> In this case, authentication is not working correctly, because this
>> cookie is set for PATH /AppDir and we are on PATH / on server
>> www.example.com (so not tomcat-server.platon.sk anymore).
>> 
>> Any suggestions and ideas would be greatly appreciated.
>
> This solution worked for me:
>
> http://ctotodevelopers.blogspot.com/2006/11/question-setting-session-cookie-paths.html

--
   /\   Ondrej Jombik - nepto at platon.sk - http://nepto.sk - ICQ #122428216
  //\\  Platon Group - open source software development - http://platon.sk
  //\\  10 types of people: those who understand binary & those who do not





More information about the nginx mailing list