改变JSESSIONID Set-Cookie的 Path

Set-Cookie: JSESSIONID=6941712CDVA075E14PF0C8DB15UF78E5; Path=/mywebapp

如果想将Path=/mywebapp 转为 /
即:
Set-Cookie: JSESSIONID=16FB366B425C1EECD229BE1A395FD37C; Path=/

修改tomcat/conf/server.xml:
    <Connector port="NN" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="NN" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"
               emptySessionPath="true"
                />

上面是针对tomcat6的,如果是tomcat7,emptySessionPath该属性无效,
需要在context.xml加sessionCookiePath:
<Context ... sessionCookiePath="/" > ... </Context>

你可能感兴趣的:(tomcat,tomcat7,Path,JSESSIONID)