I have a logon link on my homepage that shows when a user is logged out. When they are logged in it instead shows the link to my dashboard. This is handled server side and come from server in the HTML.
I have an Issue when a user follows this sequence:
- loads homepage
- clicks login
- logs in and is directed to dashboard
- clicks home link and is brought back to homepage
When they do this the homepage is loaded from local cache and still displays the log in link instead of the dashboard link.
If I hit refresh in the browser then it loads the new page with correct link.
I have tried adding the following headers to the HTML:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
But this doesn't help.
In network tab this is the response headers when loading th page logged out:
accept-ranges: bytes
content-encoding: gzip
content-length: 10290
content-type: text/html
date: Sun, 19 Sep 2021 03:29:38 GMT
etag: "6146829a-2832"
last-modified: Sun, 19 Sep 2021 00:21:46 GMT
referrer-policy: no-referrer-when-downgrade
server: nginx/1.19.5
I am testing in latest version of chrome.
Why does clicking home link load from cache instead of getting the new page?