Expires

Contains a date and time after which the current response is stale and should be refetched.

When a webpage or image is sent from a server to a client web browser, the content is usually considered to be valid for some period of time. This allows the browser to cache the resource. If the resource is requested again (because the user reloaded the page, for example), then the browser can immediately use the cached value without fetching it again from the server. Caching is very important on the internet for making web pages load quicker and reducing load and bandwidth requirements on the server. There are frequently additional caching layers between the server and client (for example, a content delivery network) that can save additional load and bandwidth.

When a resource gets old enough, it will expire and the cache will fetch a new copy from the server. The server needs a way to communicate this information to the cache and the Expires header is one of those ways. This header contains a date and time after which the resourced should be considered to be expired.

Expires: Wed, 22 Mar 2023 22:47:49 GMT

If a server wishes to control when its resources expire, they can set this date/time to some future value. If the server wishes for the content to be immediately expired, and thus never cached, it can set a date in the past or simple send a value of 0.

For example, an infrequently changed page could be set to expire in 30 days. This means that if a person visited a webpage and then returned 29 days later, they would get the same old copy of the page and the server would not even know that it happened. Typically, webpages are given short lifetimes (or none at all) and images are given long lifetimes.

This header is used along with the Date Header to determine when to expire the document. The Date header is used to determine what time the server thinks it is. In the case where the clock on the server has drifted significantly from the client, then this difference is used to offset the Expires header by the appropriate amount.

The Cache-Control Header is a newer, more configurable, and preferred way to control caching, but the Expires header is still necessary if you want to support older HTTP/1.0 clients. For more information about this and other caching headers, please read our HTTP Caching Tutorial.

Ready to validate your website to check for this header and 100+ others important tests?