Overview#
HTTP Cache Directive are parameters for the
HTTP Header Field Cache-Control
HTTP Cache Directives are Case-insensitive and have an optional argument, that can use both token and quoted-string syntax. Multiple directives are comma-separated.
HTTP Cache Directives are defined in the IANA Registry Hypertext Transfer Protocol (HTTP) Cache Directive Registry
Standard HTTP Cache Directive directives that can be used by the
client in an
HTTP Request.
- Cache-Control: max-age=<seconds>
- Cache-Control: max-stale[=<seconds>]
- Cache-Control: min-fresh=<seconds>
- Cache-control: no-cache - Forces caches to submit the request to the origin server for validation before releasing a cached copy.
- Cache-control: no-store
- Cache-control: no-transform
- Cache-control: only-if-cached - Indicates to not retrieve new data. The client only wishes to obtain a cached response, and should not contact the origin-server to see if a newer copy exists.
Standard HTTP Cache Directive directives that can be used by the
server in an
HTTP Response
- Cache-control: must-revalidate - The cache must verify the status of the stale resources before using it and expired ones should not be used.
- Cache-control: no-cache - Forces caches to submit the request to the origin server for validation before releasing a cached copy.
- Cache-control: no-store - Indicates to not retrieve new data. The client only wishes to obtain a cached response, and should not contact the origin-server to see if a newer copy exists.
- Cache-control: no-transform
- Cache-control: public - Indicates that the HTTP Response may be cached by any cache.
- Cache-control: private - Indicates that the response is intended for a single user and must not be stored by a shared cache. A private cache may store the response.
- Cache-control: proxy-revalidate
- Cache-Control: max-age=<seconds>
- Cache-control: s-maxage=<seconds>
Extension HTTP Cache Directive HTTP Cache Directive #
Extension HTTP Cache Directive directives are not part of the core
HTTP caching standards document. Be sure to check the compatibility table for their support.
- Cache-control: immutable
- Cache-control: stale-while-revalidate=<seconds>
- Cache-control: stale-if-error=<seconds>
There might be more information for this subject on one of the following: