HTTP Headers
If Unmodified Since
The HTTP If-Unmodified-Since
request header makes the request for the resource conditional.
The server will send the requested resource (or accept it in the case of a POST
or another non-safe method) only if the resource on the server has not been modified after the date in the request header.
If the resource has been modified after the specified date, the response will be a 412 Precondition Failed
error.
The If-Unmodified-Since
header is commonly used in the following situations:
- In conjunction with non-safe methods like
POST
, this header can be used to implement optimistic concurrency control. For example, some wikis reject revisions if the stored document has been modified since it was originally retrieved, thus avoiding conflicts. - Combined with a range request using the
Range
header, this header can ensure that the requested fragment comes from a document that has not been modified since the specified date.
Header type | Request header |
---|---|
Forbidden request header | No |
Syntax
If-Unmodified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
Directives
<day-name>
Specify the day of the week using one of the following case-sensitive options:
Mon
,Tue
,Wed
,Thu
,Fri
,Sat
, orSun
.<day>
Provide the day of the month as a two-digit number, such as “04” or “23”.
<month>
Specify the month using one of the three-letter abbreviations:
Jan
,Feb
,Mar
,Apr
,May
,Jun
,Jul
,Aug
,Sep
,Oct
,Nov
, orDec
. These are case-sensitive.<year>
The four-digit year, such as “1990” or “2016”.
<hour>
The hour in 24-hour format as a two-digit number, e.g., “09” or “23”.
<minute>
The minutes as a two-digit number, e.g., “04” or “59”.
<second>
The seconds as a two-digit number, e.g., “04” or “59”.
- GMT
Greenwich Mean Time. HTTP dates are always expressed in GMT rather than local time.
Example
If-Unmodified-Since: 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 If Unmodified Since header. This is particularly useful when you want to test how your application handles conditional requests or cache validation during development or debugging. Steps to Modify the If Unmodified Since 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 If-Unmodified-Since.
- In the “Header Value” field, enter the date value you want to test (e.g., Wed, 21 Oct 2015 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.
Once set up, Requestly will inject the If-Unmodified-Since header into all matching requests, allowing you to simulate conditional requests and test how your server handles updates and concurrency controls.
Table of Contents
- No headings found.