You can consider, disabling the caching of a page in the browser. For doing so, see this: https://coderanch.com/t/414250/JSP/java/back-button#1826301 Once this is done, any back button would result in the page being fetched from the server, and in the server you can handle your requirement, like invalidating the session(if it exists) and creating a new one.
Thanks and Regards
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop