HTTP Headers
Expires
The HTTP Expires
response header specifies the date and time after which the response is considered expired within the context of HTTP caching. When the value is set to 0
, it indicates that the resource has already expired, as it represents a date in the past.
Syntax
Expires: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
Directives
Directives specify the format and structure for date and time representations in HTTP headers. They define how to interpret or generate date and time strings that are communicated between clients and servers. Below are the key directives used in HTTP date formatting:
One of Mon, Tue, Wed, Thu, Fri, Sat, or Sun (case-sensitive). Examples:
Two-digit day number, such as “04” or “23”.
One of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec (case-sensitive).
Four-digit year number, like “1990” or “2016”.
Two-digit hour number, for example, “09” or “23”.
Two-digit minute number, such as “04” or “59”.
Two-digit second number, like “04” or “59”.
Greenwich Mean Time (GMT) is used for HTTP dates. All dates are expressed in GMT, not local time.
Example
Expires: Wed, 21 Oct 2015 07:28:00 GMT
How to Modify Header using Requestly
Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Expires header. This is especially useful for controlling caching policies during development or debugging. Steps to Modify the Expires Header:
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Expires.
- In the “Header Value” field, enter the desired expiration date and time in RFC 1123 format (e.g., Wed, 21 Oct 2025 07:28:00 GMT).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
After configuring, Requestly will inject the Expires header into all matching requests, which helps you test how your application handles caching and how content is refreshed based on expiration times.
Modifying the Expires header is important when you want to control how long browsers cache certain resources. This can help you avoid outdated content or test different caching strategies without changing the server configuration.
Table of Contents
- No headings found.