Search code examples
httpexpresscache-control

Prevent any caching in the browser


Which header(s) can I use to prevent any caching on the part of the browser?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

would it simply be:

res.setHeader('cache-control','no-cache');

Solution

  • Cache-Control: no-store is sufficient.

    See: https://www.mnot.net/blog/2017/03/16/browser-caching