Reputation: 1283
We had a production release and there were issues due to javascript that we updated. The clients have an old cached version of the javascript file which is causing the issue. The workaround is to have them refresh their browser cache (hit F5) but Im trying to understand how long the javascript gets cached by default.
I do not see the cache-control headers or Expired header being set on the server side and I do not see those headers in the developer console in chrome. I DO see the below meta tags are set on the page. These meta tags would lead me to believe the JS is not cached - however we know it is because we have many users reporting issues and hitting F5 fixes it.
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
So back to my original question - how long is the javascript going to be cached by default if we set no cache headers. I apologize since Im sure this question is asked elsewhere I just cant seem to find a concrete answer. Here are all the headers I can see being set:
Accept-Ranges:bytes
Connection:Keep-Alive
Content-Length:157271
Content-Type:application/x-javascript
Date:Tue, 23 Feb 2016 15:37:38 GMT
Keep-Alive:timeout=15, max=500
Last-Modified:Sat, 20 Feb 2016 10:57:45 GMT
Strict-Transport-Security:max-age=31536000; includeSubDomains
X-Content-Type-Options:nosniff
Upvotes: 3
Views: 6981
Reputation: 1283
Im aware of how to add cache headers. We have a production issue affecting many clients. For a large site its no small thing to migrate the fix to production. I am trying to find out how long the browser cached by default because that is how long the issue will exist for our clients before the browser will naturally refetch the newer version of the javascript if we do not migrate the fix. For instance if it was 2 days then the issue would already have cleared itself up without us taking action.
Seems like the answer was right in front of me though. There are no cache headers but the below tag seems to be saying cache forever regardless of the no-cache meta tags right before it.
<meta http-equiv="expires" content="0">
So we have to do a production migration and add cache busters to all our javascript to fix the issue or keep telling every client to refresh the page.
Upvotes: 1