I looked it up and as it turns out, their flush caching facility is not available to me in the wordpress dashboard as it is a subdirectory /wp/ installation. This page was last modified on ⁨Jul 4, 2025⁩ by MDN contributors. Must-understand should be coupled with no-store for fallback behavior.

Middleware to turn off caching

Use a no-cache to make sure that the HTML response itself is not cached. No-cache could cause revalidation, and the client will correctly receive a new version of the HTML response and static assets. The React library version will change when you update the library, and hero.png will also change when you edit the picture. If you don’t want a response stored in caches, use the no-store directive. For example, a request with the header above indicates that the browser will accept a stale response from the cache that has expired within the last hour.

  • If you don’t want a response stored in caches, use the no-store directive.
  • Ask the origin server whether or not the stored response is still fresh.
  • It does this by requiring caches to revalidate each request with the origin server.
  • When you use a cache-busting pattern for resources and apply them to a long max-age, you can also add immutable to avoid revalidation.

immutable

The Cache-Control header is used to specify directives for caching mechanisms in both HTTP requests and responses. If you don’t add a Cache-Control header because the response is not intended to be cached, that could cause an unexpected result. Cache storage is allowed to cache it heuristically — so if you have any requirements on caching, you should always indicate them explicitly, in the Cache-Control header. For content that’s generated dynamically, or that’s static but updated often, you want a user to always receive the most up-to-date version.

Clearing an already-stored cache

Imagine that clients/caches store a fresh response for a path, with no request flight to the server. Clients can use this header when the origin server is down or too slow and can accept cached responses from caches even if they are a bit old. The stale-while-revalidate response directive indicates that the cache could reuse a stale response while it revalidates it to a cache. The proxy-revalidate response directive is the equivalent of must-revalidate, but specifically for shared caches only. If you want caches to always check for content updates while reusing stored content, no-cache is the directive to use.

Preventing storing

This feature is well established and works across many devices and browser versions. By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy. Alright, this is due to the pain that godaddy gives me by implementing their own caching in a MANAGED WORDPRESS hosting.

  • This Express middleware sets some HTTP response headers to try to disable client-side caching.
  • Revalidation will make the cache be fresh again, so it appears to clients that it was always fresh during that period — effectively hiding the latency penalty of revalidation from them.
  • This means that the response is access-controlled for restricted users (who have accounts), and it’s fundamentally not shared-cacheable, even if it has max-age.

It does this by requiring caches to revalidate each request with the origin server. The no-cache response directive indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. This usually means the response can be reused for subsequent requests, depending on request directives. Ask the origin server whether or not the stored response is still fresh.

The list is just examples of different techniques, it’s not for directinsertion. If copied, the second would overwrite the first and thefourth would overwrite the third because of the http-equivdeclarations AND fail with the W3C validator. At most, one could haveone of each http-equiv declarations; pragma, cache-control andexpires. These are completely outdated when using modern up to date browsers.After IE9 anyway. Chrome and Firefox specifically does not work with these as you would expect, if at all.

Resources

If you forget to add private to a response with personalized content, then that response can be stored in a shared cache and end up being reused for multiple users, which can cause personal information to leak. There are no cache directives for clearing already-stored responses from caches on intermediate servers. The stale-if-error response directive indicates that the cache can reuse a stale response when an upstream server generates an error, or when the error is generated locally. Here, an error is considered any response with a status code of 500, 502, 503, or 504. When a user reloads the browser, the browser will send conditional requests for validating to the origin server.

HTTP allows caches to reuse stale responses when they are disconnected from the origin server. Must-revalidate is a way to prevent this from happening – either the stored response is revalidated with the origin server or a 504 (Gateway Timeout) response is generated. The must-revalidate response directive indicates that the response can be stored in caches and can be reused while fresh. If the response becomes stale, it must be validated with the origin server before reuse. Cache that exists between the origin server and clients (e.g., Proxy, CDN). It stores a single response and reuses it with multiple users — so developers should avoid storing personalized contents to be cached in the shared cache.

The immutable response directive indicates that the response will not be updated while it’s fresh. However, cacheing headers are unreliable in meta elements; for one, any web proxies between the site and the user will completely ignore them. You should always use a real HTTP header for headers such as Cache-Control and Pragma.

Browsers usually add no-cache to requests when users are force reloading a page. No-cache mining benchmark tool allows caches to store a response but requires them to revalidate it before reuse. If the sense of “don’t cache” that you want is actually “don’t store”, then no-store is the directive to use. When you update the library or edit the picture, new content should have a new URL, and caches aren’t reused.