What is the difference between Cache-Control and Expires?
Quick answer
Cache-Control is the more flexible response header: its directives can set freshness as a duration, such as max-age=3600, and express other caching behavior. Expires gives a date and time after which a response is considered stale. When both Cache-Control: max-age and Expires are present, max-age takes precedence. Actual handling also depends on the directives, cache type, and HTTP rules. [S1] [S2]
The question, the details, the next step.
A practical checklist
Copy the full Cache-Control header value, not only the max-age number.
Note the Expires date and time if that header is present.
Check whether max-age and Expires express different freshness periods; max-age takes precedence when both are present.
If reviewing a shared cache, check for s-maxage, which overrides max-age or Expires there when present.
Record whether the question concerns a browser or shared cache before interpreting the headers.
A few more useful answers
Does Expires take precedence over Cache-Control: max-age?
No. When both are present, max-age takes precedence over Expires. [S2]
What does s-maxage change?
It applies to shared caches and, when present, overrides max-age or Expires there. [S1]
Does seeing these headers prove exactly how a specific cache behaved?
No. The directives, cache type, and HTTP rules matter, and these general facts do not establish the behavior of a particular cache product. [S1]
Sources
References used for this guide.
- [S1] Cache-Control header — HTTP | MDN developer.mozilla.org · Checked
- [S2] HTTP caching — HTTP | MDN developer.mozilla.org · Checked
