Cookies path rewrite

Ondrej Jombik nepto at
Sat Oct 25 00:54:20 MSD 2008


I'm writing to this list, since I was unable to find solution online.

We are using nginx on our all servers and we are very satisfied.
Thank you very much for this wonderfull work!

One type of our usage is to serve Tomcat 5.5 applications on specified
desired domains. For example: <--[nginx]-->

This works great, however we need to use rewrite this way for removing
/AppDir/ from links, FORM actions and so on:

server {
     listen 80;
     rewrite ^/AppDir/(.*) /$1;

     location / {

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 (so not anymore).

Any suggestions and ideas would be greatly appreciated.

Thank you


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

More information about the nginx mailing list