OSC / ondemand

Supercomputing. Seamlessly. Open, Interactive HPC Via the Web
https://openondemand.org/
MIT License
287 stars 106 forks source link

Configure NGINX to handle cache validation for static assets #6

Open ericfranz opened 6 years ago

ericfranz commented 6 years ago

We should configure NGINX to auto-handle HTTP cache validation of static assets it serves by adding the Last-Modified based on the modification date of the file and handling cache validation requests e.g. https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Cache_validation.

See https://discourse.osc.edu/t/newby-question-how-to-link-an-external-css-file-to-an-app-in-ondemand/60/2 for a discussion about cache busting concerns.

You would know this is solved if:

  1. your app uses code that is mostly in static assets in public/ directory of the app
  2. your app does not employ any cache busting strategy for these assets
  3. you verify that you can make changes to these files and client browsers will fetch new versions of the files on future requests (also client browsers should be making cache validation requests when navigating to another page)

┆Issue is synchronized with this Asana task by Unito

matt257 commented 5 months ago

reviewed, good idea eventually