Tomcat 7 session cookie path

Juriy picture Juriy · Oct 20, 2010 · Viewed 26.7k times · Source

I'm having a huge problem with my application and Tomcat 7. My application needs to set session cookie to "/" path instead of "/context" path. In tomcat 6 it was a matter of adding another property to Connector (emptySessionPath="true") and Tomcat 7 doesn't recognize this thing. I know that Servlet 3.0 spec allows to configure it on per-context basis, but I couldn't make it work with Tomcat 7. It still adds the context path instead of "/".

I will be very grateful for the receipt on how to do it.

Answer

Vadim picture Vadim · Oct 28, 2010

Juts put the sessionCookiePath="/" attribute into your context.xml root node:

<Context ... sessionCookiePath="/" > ... </Context>