Expires Header

Table of Content

The Expires Header is a part of HTTP response headers, and its main function is to instruct the web browser on how long it can cache and use the specific resources without needing to request them again. It essentially defines an expiration date and time for cached content and, after the given date or time is passed, the content is considered stale and must be re-fetched from the server, providing control over resource caching, ultimately enhancing web performance.

Syntax

Expires: <http-date>

Directives

The Expires Header only has one directive, which is the <http-date>. This is where the date is set in HTTP-date format. If the expiration date is set to past, it acts as '0' allowing no caching.

Examples

Here's an example of an Expires Header set to an expiration date:

Expires: Wed, 21 Oct 2025 07:28:00 GMT

Or, to disable caching:

Expires: 0

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Expires header

ModHeader is a Chrome extension that can be used to modify the HTTP request and response headers. With it, you can ensure the caching or freshness of certain resources by modifying the Expires Header. Here's how:

  1. Install and open ModHeader.
  2. Click on + sign to add a new header.
  3. In the Name box, input Expires.
  4. In the Value box, input the desired expiration date in HTTP-date format, e.g., Wed, 21 Oct 2025 07:28:00 GMT, or 0 to disable caching.
  5. Navigate to your webpage to see the effect.

This ability to control cache behavior can prove useful during web development or testing, as you can manipulate cache behavior without altering server settings.