I've recently started developing e-commerce app with multiple types of users, and currently I am experiencing some issues with browsers Page Cache. Here is one example for user authentication
- Authentication Token is generated 
- Authentication Token is written into the database 
- Authentication Token and its expiry is saved into the user session 
I wrote middleware that checks if user is authenticated and if its authorized (checks the token and access level) as well as expiry - tested it, it works. On "Log Out" I am destroying a session and renewing the token with Session.Destroy(r.Context()) and Session.RenewToken(r.Context())
Here is the problem:
- I log in as "Admin" and go to DASHBOARD page for which only admin users are authorized to access. 
- I logout 
- I login as regular user and click "BACK' on browser it takes me to Dashboard page when it should not. But, when I refresh the page it does say "UNAUTHORIZED" which is what I was expecting when clicking "back" or something. 
I was searching through the internet and found a "solution" where I set the headers in the following manner:
 w.Header().Set("Cache-Control", "no-cache, private, max-age=0")
  
  w.Header().Set("Expires", time.Unix(0, 0).Format(http.TimeFormat))
  
  w.Header().Set("Pragma", "no-cache")
  
  w.Header().Set("X-Accel-Expires", "0")
This however, does not work for me. I do see these headers in the NETWORK card when I open my Web Developer Tools, but problem remains.
What am I doing wrong?

