I recently upgraded my application from Tomcat 8 to Tomcat 9 and am experiencing an issue with cookies not being cleared
Relevant Code:
Here’s how I’m handling the logout and cookie clearing:
Cookie cookie = new Cookie("UniToken", "");
cookie.setPath("/");
cookie.setMaxAge(0);
response.addCookie(cookie);
New Environment Details: Tomcat 9, JDK 8
Old Environment Details: Tomcat 8, JDK 8
Troubleshooting Done:
- Verified that the cookie path and other settings are identical in both environments.
- Checked Tomcat configurations (
server.xml
,context.xml
,web.xml
) and they are consistent across both environments. - Added logs to track cookie values, which confirmed that the cookie should be cleared as specified.
Could this be related to Tomcat’s configuration when upgrading from Tomcat 8 to Tomcat 9 ?
New contributor
Coch-K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.