If-Unmodified-Since Header
Table of Content
The If-Unmodified-Since HTTP header is used by clients to make a conditional request to the server. The functionality of this header is to ask the server to process the requested action only if the targeted resource has not been modified after a given date and time. The primary purpose of this header is to make sure that the client-side copy of data is synchronized with the server-side copy.
Syntax
The syntax for the If-Unmodified-Since header is quite straightforward. You simply specify the header followed by a date. Here is an example:
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
Directives
The If-Unmodified-Since header supports a single directive, which is a HTTP-date timestamp. This timestamp is compared with the modification date of the resource, and if the resource has been modified since the given timestamp, the server will return a 412 Precondition Failed status.
Examples
Below is an example of usage of the If-Unmodified-Since header in a HTTP GET request:
GET /index.html HTTP/1.1
Host: www.example.com
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify If-Unmodified-Since header
ModHeader is a Chrome extension that allows you to modify HTTP request headers. To modify the If-Unmodified-Since header using ModHeader, follow these steps:
- Install ModHeader from the Chrome Web Store.
- Once installed, click on the ModHeader icon in your toolbar. This will open its interface.
- In ModHeader, click on the '+' button to add a new profile.
- In your new profile, under 'Request Headers', click on the 'Add' button.
- Enter 'If-Unmodified-Since' in the 'Name' field, and enter your desired date in the 'Value' field. The date should be in the HTTP-date format (e.g., 'Sat, 29 Oct 1994 19:43:31 GMT').
- Now, all your requests will include this header, until you delete this profile or the specific header inside it.
Modifying the If-Unmodified-Since header can be useful when you want to test how your server responds to conditional requests based on modification dates.