Expires Header
You'll learn the legacy Expires HTTP header and why modern Cache-Control rules override it.
What Is the Expires Header?
The Expires header is the original HTTP/1.0 caching mechanism that tells browsers when a cached resource becomes stale. Unlike Cache-Control (which uses relative time like max-age=3600), Expires specifies an absolute date and time when the resource expires.
Expires: Wed, 21 Oct 2025 07:28:00 GMT
This tells the browser: "You can use this cached version until October 21, 2025 at 7:28 AM GMT. After that, fetch a fresh copy."
Why It's Legacy (But Still Relevant)
The Expires header has significant drawbacks:
- Clock dependency: If the server clock is wrong, or the client's clock differs from the server's, caching breaks
- Date format complexity: Requires precise HTTP-date formatting
- Less flexible: Can't express nuanced caching policies like
no-cacheormust-revalidate
That's why Cache-Control was introduced in HTTP/1.1 with relative time directives.
The Precedence Rule
Here's the critical behavior: If both Cache-Control and Expires are present, Cache-Control wins. The browser ignores Expires entirely.
Cache-Control: max-age=3600
Expires: Wed, 21 Oct 2025 07:28:00 GMT
The browser uses the 1-hour max-age and disregards the 2025 expiration date.
However, Expires still serves as a fallback for very old browsers that don't understand Cache-Control. Modern practice is to send both headers for maximum compatibility.
Key Takeaway: The Expires header sets an absolute expiration date for cached resources, but Cache-Control always takes precedence when both are present—use Expires as a backward-compatibility fallback only.