Set "safe" flag in JSESSION id cookie

I want to set the "safe" flag in the JSESSIONID cookie. Is there any configuration in tomcat 6 for this?

I tried setting 'secure = "true" in the' Connector '(8080) element of server.xml, but it creates problems ... thats Connection gets reset.

Please note that in my application the JSESSIONID is created in the "http" mode (index page), when the user logs in, he switches to the "https" mode.

+2
source share
2 answers

If you are using tomcat 6, you can do the following workaround

String sessionid = request.getSession().getId();
response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; secure ; HttpOnly");

. https://www.owasp.org/index.php/HttpOnly

+3

useHttpOnly = "true". Tomcat9 - true.

0

All Articles