How to set no cache on only the index.html page in NGINX How to set no cache on only the index.html page in NGINX nginx nginx

How to set no cache on only the index.html page in NGINX


I only want to prevent the index.html page from storing cache.

  • no-cache: prevents from reusing the resource without validating it
  • no-store: prevents from storing the cache on client side

In your case I'd try this:

location = /index.html {    internal;    add_header Cache-Control 'no-store';}

...and then CTRL+F5 to force refresh all resources in your browser.
From this point your index.html should work in the way you wanted.