Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome and Firefox not clearing JSESSIONID cookie causes a redirect loop

I have an application that receives HTTP/HTTPs requests on Apache Web Server and passes it on to tomcat.

Recently, I've been facing problems with sessions and redirection loops on Google Chrome and Firefox browsers after some user logs out the expiration of sessions. I managed to trace down the problem and found that the browser is not clearing the JSESSIONID cookie. After manually clearing that, it starts to work again.

I have checked the log files of Apache Web Server and I found this:

172.16.254.157 - - [06/Feb/2017:05:23:27 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:29 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:29 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:29 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:30 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:30 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:30 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:31 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:31 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:31 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:32 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:32 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:32 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:33 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:33 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:33 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:34 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:34 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:34 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:35 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
172.16.254.157 - - [06/Feb/2017:05:23:35 -0600] "GET /preview/login.admin HTTP/1.1" 302 20
122.176.45.206 - - [06/Feb/2017:05:24:33 -0600] "GET /preview/login.admin HTTP/1.1" 302 20

Apache Server is getting these requests, but nothing is being forwarded to Tomcat.

The network tab of Chrome's inspect element window shows me this: enter image description here

But this works after I clear the JSESSIONID cookie.


This is rather strange, but this issue started about a week ago (The application is working since last 4 years!), and that coincides with the new update rollout.

I have tried googling stuff and found out that people had similar issues back in 2012 and '15.

Is something really wrong with Chrome? Are the internet standards changing? Nonetheless, how can I fix this?


EDIT:

1. The issue is only with Google Chrome.


Edit #2:

  1. The problem has started with Mozilla Firefox as well.
like image 203
Jay Avatar asked Sep 14 '25 13:09

Jay


1 Answers

If you look carefully at your traffic it appears to be alternating between http and https.

Two guesses:

(a) there is a redirect rule working against you, e.g. someone thought it would be a good idea to auto-redirect http to https, but not using HSTS.

(b) the site is setting a secure cookie but redirecting to a non-secure endpoint afterward, so the cookie isn't presented; the web site redirects you back to the login page (since you don't look authenticated), which then drops the cookie as part of a session fixation mitigation.

Or (c) the two issues above are interacting to cause the behavior.

like image 80
John Wu Avatar answered Sep 16 '25 07:09

John Wu