Skip to content

update nginx config to stop caching static content - ICSHWI-8795

John Sparger requested to merge nginx-nocache-static-content-ICSHWI-8795 into develop

Update nginx configuration to add "no caching" headers index.html and other nonstatic content. Caching index.html will prevent users from receiving updates because index.html explicitly loads the javascript from our build's static directory. Even though new js/css files with new names are generated by the build to avoid caching problems, index.html always keeps the same name and a cached version will reference older versions of the js files. These older versions will have been cached at the same time as the old index.html and will be loaded instead of the new version of our app. We have some other nonstatic files that also should not be cached, like config.js.

This is fix for https://jira.esss.lu.se/browse/ICSHWI-8795

Results of this merge request

On first load of page after clearing the browser cache, index.html, config.js (here called ccce-demo.cslab.esss.lu.se) and all the static js files are retrieved fresh from the server:

image

On re-load of this page index.html (here styled as ccce-demo.cslab.esss.lu.se) and config.js are not cached, but the static js sources still are (that's good):

image

One problem though... static CSS is not being cached now. Why?

Edited by John Sparger

Merge request reports