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.
Browse Food Categories
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 correctly receive a new version of the HTML response and static assets.
private
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.
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.
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.
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.
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.
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.
- The HTTP Cache-Control header carries directivescontrolling how browsers, proxies, and CDNs store andserve cached responses.
- The public response directive indicates that the response can be stored in a shared 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.
- HTTP allows caches to reuse stale responses when they are disconnected from the origin server.
- The table below shows which directives apply torequests, responses, or both.
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.
Folders and files
The no-store directive prevents any cache fromstoring the response. This directive is useful when an originserver is temporarily unreachable and a slightly staleresponse is acceptable. Unrecognized directives are ignored by caches.This allows new directives to be introducedwithout breaking older implementations. Origins, intermediaries, and clients all rely onCache-Control to agree on when a stored responseremains usable and when a fresh copy is needed. Adding no-cache to the response causes revalidation to the server, so you can serve a fresh response every time — or if the client already has a new one, just respond 304 Not Modified.
Directives
Sharedcaches such as CDNs and proxy servers discard theresponse. The private directive restricts storage to privatecaches, typically the end user’s browser. Once stale, the cachecontacts the origin to revalidate before serving theresponse again.
Cache directives
- The public directive is unnecessary whenmust-revalidate or s-maxage is already present.
- If the response becomes stale, it must be validated with the origin server before reuse.
- After the hour elapses, caches treat theresponse as stale and either revalidate or fetch anew copy depending on other directives present.
- For SEO and caching assistance, contactex-Google SEO consultantsSearch Brothers.
- Different health concerns have been tied to ultra-processed food.
Clients can use this header when the user requires the response to not only be fresh, but also requires that it won’t be updated for a period of time. 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. When a user reloads the browser, the browser will send conditional requests for validating to the origin server. The immutable response directive indicates that the response will not be updated while it’s fresh. No-transform indicates that any intermediary (regardless of whether it implements a cache) shouldn’t transform the response contents. If a cache supports must-understand, it stores https://burnenergyhouse.com/en-in/ the response with an understanding of cache requirements based on its status code.
Repository files navigation
If /assets/ files are suitable for storing in a shared cache, you also need one of public, s-maxage or must-revalidate. Note that no-cache means “it can be stored but don’t reuse before validating” — so it’s not for preventing a response from being stored. If a cache has a stored response, even a stale one, it will be returned. 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. The must-understand response directive indicates that a cache should store the response only if it understands the requirements for caching based on status code. 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.
Directives
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.
private
The public response directive indicates that the response can be stored in a shared cache. The private response directive indicates that the response can be stored only in a private cache (e.g., local caches in browsers). The no-store response directive indicates that any caches of any kind (private or shared) should not store this response. The proxy-revalidate response directive is the equivalent of must-revalidate, but specifically for shared caches https://mysmartmark.com/en-in/ only.
max-stale
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:
If you don’t add a Cache-Control header because the response is not intended to be cached, that could cause an unexpected result. You can add a long max-age value and immutable because the content will never change. Note that the major browsers do not support requests with min-fresh.
In such a case, you could address the caching needs by using a specific, numbered version of the library, and including the hash of the picture in its URL. Caches are encouraged to treat the value as if it were 0. Many browsers use this directive for reloading, as explained below. After the stale-if-error period passes, the client will receive any error generated. Afterwards, it becomes stale, but can be used for an extra 1 day (86400s) when an error is encountered. Here, an error is considered any response with a status code of 500, 502, 503, or 504.
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.
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 ….
Use a no-cache to make sure that the HTML response itself is not cached. When you build static assets 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.
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 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.
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.
