TheOne
TheOne

Reputation: 11159

how to force all browsers to not store your site's cache?

When you are in the development stage it's a bit embarrassing to constantly remind your clients to clear the cache or to ask them to "refresh the page a bunch of times."

Is there a setting that I, the developer, can set in nginx or as a meta tag in the HTML to force all browsers to stop caching my page?

Upvotes: 1

Views: 1720

Answers (2)

cnst
cnst

Reputation: 27218

Theoretically, according to Difference between Pragma and Cache-control headers? and also http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32, the following may be sufficient, in nginx:

add_header  Cache-Control   no-cache;

In practice, you might have to specify some extra directives; it would seem like using the expires directive should be sufficient, which will automatically add the Cache-Control header as above, too:

expires -1;

Upvotes: 3

Shahe
Shahe

Reputation: 984

Try setting these headers:

"Cache-control: no-store, no-cache, must-revalidate"
"Expires: Mon, 26 Jun 1997 05:00:00 GMT"
"Pragma: no-cache"
"Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"

This will prevent the browsers from cashing the pages.

Upvotes: 2

Related Questions