dijkstra-backend-cloudron/node_modules/nocache
rui hildt 4f5db9ab26 Add initial version of dijkstra backend cloudron image 2020-10-12 11:27:15 +02:00
..
dist Add initial version of dijkstra backend cloudron image 2020-10-12 11:27:15 +02:00
CHANGELOG.md Add initial version of dijkstra backend cloudron image 2020-10-12 11:27:15 +02:00
LICENSE Add initial version of dijkstra backend cloudron image 2020-10-12 11:27:15 +02:00
README.md Add initial version of dijkstra backend cloudron image 2020-10-12 11:27:15 +02:00
package.json Add initial version of dijkstra backend cloudron image 2020-10-12 11:27:15 +02:00

README.md

Middleware to turn off caching

Build Status

It's possible that you've got bugs in an old HTML or JavaScript file, and with a cache, some users will be stuck with those old versions. This will (try to) abolish all client-side caching.

const nocache = require('nocache')
app.use(nocache())

This sets four headers, disabling a lot of browser caching:

  • Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
  • Pragma: no-cache
  • Expires: 0
  • Surrogate-Control: no-store

Caching has performance benefits, and you lose them here. It's also possible that you'll introduce new bugs and you'll wish people had old resources cached, but that's less likely.