One thing you can try is fiddling with the cache headers:
https://coderanch.com/how-to/java/NoCacheHeaders
It gets logged in automatically and shows that i have logged in back again.
Is that really what's happening? Or is it merely showing the page you would see if you were logged in? The only way to log back in would be a round trip to the server (which you can check on the server), assuming that the cookies get properly cleared. I suppose it's possible if you had used a GET instead of a POST for the login.