max-age cache directive

Response max-age defines a freshness lifetime in seconds from response generation.

  • caching
  • directives
  • freshness

Response meaning

In a response, max-age=N says the response is stale after its age exceeds N seconds. Age is calculated from response generation and time resident in upstream caches, not from when the current client first saw it.

Cache-Control: max-age=300
Age: 120

Expected result: absent other constraints, the stored response has about 180 seconds of freshness remaining at this observation.

Request meaning

In a request, max-age limits the age of a response the client is willing to accept. It does not force an origin to generate a new representation.

Precedence

For a shared cache, s-maxage overrides max-age. Max-age overrides Expires for the same response. Invalid repeated values can make freshness handling conservative.

Primary sources