[Tutorial] How to change Tomcat 7 JSESSIONID
Tomcat uses JSESSIONID as a default cookie name. And if we want to change this cookie name or customize cookie name ourselves, we have to follow the steps below.
1-) Open content.xml file which is located in {your tomcat7 root}\conf
2-) Find the <Context> part on your content.xml file.
3-) Change the sessionCookieName=”MyCookie” as you want to see.
<Context sessionCookieName="MyCookie"> <!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> --> <!-- Uncomment this to enable Comet connection tacking (provides events on session expiration as well as webapp lifecycle) --> <!-- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> --> </Context>
4-) Save the content.xml and restart tomcat server.