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. It does this by requiring caches to revalidate each request with the origin server. This section lists directives that affect caching — both response directives and request directives. Cache storage isn’t required to remove stale responses immediately because revalidation could change the response from being stale to being fresh again. Ask the origin server whether or not the stored response is still fresh.
Repository files navigation
The Cache-Control header coordinates cachingacross browsers, proxies, and CDNs through a set ofcomposable directives. A page with a longmax-age is re-fetched less often, whileno-cache signals frequent content changes andwarrants more frequent crawling. Google’s crawling infrastructure implementsheuristic HTTP caching.The max-age directive helps Googlebotdetermine recrawl frequency. The browser and any sharedcache store this response for one year withoutrevalidation. Once the background revalidation completes, the cachereplaces the stale entry with the fresh response.
private
The must-revalidate directive allows caches to servethe response while fresh. The cachestill stores the response, enablingconditional requests withETag or Last-Modified. The no-store directive asks caches not to storethe request or the corresponding response. The table below shows which directives apply torequests, responses, or both. If you don’t want a response stored in caches, use the no-store directive. 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.
Installation and Usage
The response no-cache directive requires caches torevalidate the stored response with theorigin before every reuse. The max-age directive tells caches to return a storedresponse only if the response is no older than thespecified number of seconds. The no-store request directive allows a client to request that caches refrain from storing the request and corresponding response — even if the origin server’s response could be stored. Indicates that caches can store this response and reuse it for subsequent requests while it’s fresh. Responses carrying anAuthorization header are not storedby shared caches unless the public directive ispresent.
Using Food Scores
In some cases, this is undesirable for the content provider. For example, some convert images to reduce transfer size. Some intermediaries transform content for various reasons. If a cache doesn’t support must-understand, it will be ignored. Must-understand should be coupled with no-store for fallback behavior. You can use the public directive to unlock that restriction.
Folders and files
For SEO and caching assistance, contactex-Google SEO consultantsSearch Brothers. A static asset served with a long freshness lifetimeand the immutable flag. Portions of this content are ©1998–2026 by individual mozilla.org contributors. This page was last modified on Nov 16, 2025 by MDN contributors. 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.
- Cachesskip conditional requests forimmutable resources, eliminating revalidation roundtrips for assets like versioned JavaScript bundles orfingerprinted images.
- Responses for requests with Authorization header fields must not be stored in a shared cache; however, the public directive will cause such responses to be stored in a shared cache.
- When conflicting directivesappear, the most restrictive combination applies.
- This usually means the response can be reused for subsequent requests, depending on request directives.
Store a response in caches when the response is cacheable. It can store and reuse personalized content for a single user. Note however,that rsync uses sockets, so if you try a nocache rsync, onlythe local process will be intercepted. Please note that nocache will only build on a system that hassupport for the posix_fadvise syscall and exposes it, too. The nocache tool tries to minimize the effect an application has onthe Linux file system cache.
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. The stale-while-revalidate response directive indicates that the cache could reuse a stale response while it revalidates it to a cache. If a request doesn’t have an Authorization header, or you are already using s-maxage or must-revalidate in the response, then you don’t need to use public.
- The s-maxage (shared max-age) directive overridesmax-age for shared caches such as CDNs and proxyservers.
- Must-understand should be coupled with no-store for fallback behavior.
- The no-transform directive forbids intermediariesfrom modifying the response body, such as recompressingimages or converting media formats.
- Cache storage isn’t required to remove stale responses immediately because revalidation could change the response from being stale to being fresh again.
Response Directives
Test live and from different countries the HTTP responses, redirect chains and status codes of one or multiple URLs. A CDN-targeted policy giving the shared cache aten-minute window while the browser cache gets oneminute. The parameter defineshow many additional seconds the stale response remainsacceptable. When conflicting directivesappear, the most restrictive combination applies. No-cache could cause revalidation, and the client will https://monsterenergyhouse.com/ correctly receive a new version of the HTML response and static assets.
If the origin is unreachable, thecache returns a 504 instead of serving stalecontent. The timerstarts from the moment the origin creates the response,so transit time and time spent in intermediate cachescount against the budget. The no-transform directive forbids intermediariesfrom modifying the response body, such as recompressingimages or converting media formats. To prevent a cache from storing a response atall, use no-store instead. Multiple directives are separated by commas in asingle header value or split across multipleCache-Control headers.
Use a no-cache to make sure that the HTML response itself is not cached. When you build static assets https://bh-marketinggroup.com/ with versioning/hashing mechanisms, adding a version/hash to the filename or query string is a good way to manage caching. In theory, if directives are conflicted, the most restrictive directive should be honored. If no cached response is available, a 504 Gateway Timeout response will be returned.
Repository files navigation
EWG has identified over 200 foods containing cancer-linked potassium bromate! Text STOP to stop receiving messages. Message and data rates may apply. By submitting your cell phone number you are agreeing to receive periodic text messages from this organization. Our tools let you make informed choices that support a healthier food system, one bite at a time.
Navigate EWG’s Food Scores:
After freshnessexpires, caches serve the stale copy whilerevalidating in the background. The stale-while-revalidate directive extends theusability window of a stale response. The public directive is unnecessary whenmust-revalidate or s-maxage is already present.
EWG’s Food Scores
Imagine that clients/caches store a fresh response for a path, with no request flight to the server. The no-cache request directive asks caches to validate the response with the origin server before reuse. 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. HTTP allows caches to reuse stale responses when they are disconnected from the origin server. The cache stores the response for five minutesand revalidates before reuse once stale. The public directive marks a response as eligiblefor storage in shared caches.
Cache directives
The HTTP Cache-Control header holds directives (instructions) in both requests and responses that control caching in browsers and shared caches (e.g., Proxies, CDNs). Responses for requests with Authorization header fields must not be stored in a shared cache; however, the public directive will cause such responses to be stored in a shared cache. There are no cache directives for clearing already-stored responses from caches on intermediate servers. The must-revalidate response directive indicates that the response can be stored in caches and can be reused while fresh.
A request carrying no-cache requires the cache tovalidate the stored response with theorigin before serving the copy. The cache returns thestored copy only if the response will stay fresh forthe additional period. The max-stale directive signals acceptance of aresponse whose Age has exceeded the freshnesslifetime by up to the given number of seconds. Both requests and responses usethis header to coordinate Caching behavior acrossthe entire delivery chain.
max-stale
Stale responses are served for up to 30seconds while the CDN revalidates in the background. The parameter sets the number of secondsbeyond the freshness lifetime during which the staleresponse remains usable as a fallback. Cachesskip conditional requests forimmutable resources, eliminating revalidation roundtrips for assets like versioned JavaScript bundles orfingerprinted images. The immutable directive guarantees the response bodywill not change during the freshness lifetime.
We fight for a safer, more transparent food system. Data provided by LabelINSIGHT® and backed by science-based food safety systems. Not all processed foods are bad but some are more concerning than others. EWG’s Food Scores helps you make informed choices about what’s in your food and how it’s produced and processed. Also, you can use vmstat 1 to view cache statistics.
Navigate EWG’s Food Scores:
In general, when pages are under Basic Auth or Digest Auth, the browser sends requests with the Authorization header. If the response becomes stale, it must be validated with the origin server before reuse. Implementation that holds requests and responses for reusing in subsequent requests. If you want to change this threshold, you can supply theenvironment variable NOCACHE_MAX_FDS and set it to a higher (or lower) value.It should specify a value one greater than the maximum file descriptor thatwill be handled by nocache. With nocache, the original caching state will be preserved. For debugging purposes, you can specify a filename that nocache should logdebugging messages to via the -D command line switch, e.g. use nocache -D /tmp/nocache.log ….

Comments are closed.