Browsers cache web application despite of headers that disable caching
We regularly deploy an Angular based web application. Simplified this application consists of an
index.html and multipe
Nginx is configured to not cache the
/ (equates to
index.html) but cache the resource files css and js forever. This is feasible because the resource file names change for every update:
index.html -> include `my-timestamp.css` index-html -> include `my1-timestamp.js`
The strange thing is that suddenly (it worked before for months) our main browser (Internet Exploder 11) uses an outdated
index.html and tries to retrieve for example
If this would happen only with IE I would blame that one but the same happens with a recent Chrome too.
Headers for the root:
cache-control: no-cache date: Fri, 24 May 2019 20:17:00 GMT etag: "1dc09d84-322" expires: Fri, 24 May 2019 20:16:59 GMT last-modified: Sat, 26 Oct 1985 08:15:00 GMT
Headers for the resources:
cache-control: max-age=2592000 cache-control: public etag: "1dc09d84-12d68" expires: Sun, 23 Jun 2019 20:17:02 GMT last-modified: Sat, 26 Oct 1985 08:15:00 GMT
There is no proxy between the browsers and the webserver.
We noticed one thing: it looks like our build process that builds the Angular application no longer creates "sane" timestamps. All files are from 1985 (you can see this in the
last-modified header), before they carried the date they were built on. But I don't see how this could change the browsers behaviour.