问题
I tried to rename JSESSIONID as below in web.xml, but seems like sometimes I do see the default name in the logs(I am logging in a filter in case default name is given), any idea?, I am using spring 3.2.18 and servlet-api-3.1
<session-config>
<session-timeout>45</session-timeout>
<cookie-config>
<path>/</path>
<domain>.example.com</domain>
<name>XXX_JSESSIONID</name>
</cookie-config>
</session-config>
回答1:
As you are using spring-3.2.18
you should try the following code to override DefaultCookieSerializer
. You can find detail information in Spring Docs
@Bean
public DefaultCookieSerializer defaultCookieSerializer(){
DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer();
defaultCookieSerializer.setCookieName("mySessionId");
return defaultCookieSerializer;
}
来源:https://stackoverflow.com/questions/54698948/renaming-jsessionid