HTTP headers | If-None-Match
The HTTP Header If-None-Match is a request-type header. Generally, it is used to update the entity tags on the server. Firstly, the Client provides the Server with a set of entity tags (E-tags). The Server compares the given tags with those it already has for the resource. Then, the Server will provide the requested page with a 200 status code only when none of the entity tags given to it matches. Or else, a 304 Not Modified status is returned by the Server.
There are two types of algorithms used to compare the entity tags. They are:
- Weak Comparison Algorithm
- Strong Comparison Algorithm
Weak comparison algorithm: It neglects minor differences which are considered to be unimportant between the entity tags. For example, two tags having the same contents but with different dates are considered to be identical.
Strong comparison algorithm: It checks the tags byte-to-byte.
Note : “*” is used to represent any resource.
Directives: This header accepts two directives as mentioned above and described below:
- entity_tag: It represents the resource which is requested. It is a string which contains alphabets, numbers and other special characters enclosed within double quotes (” “).
- “*”: It represents any resource and is used to avoid race conditions between PUT operations. When this directive is used, the server should not perform the requested method if the entity is given to it already exists for that resource.
To check this If-None-Match in action go to Inspect Element -> Network check the request header for If-None-Match like below. The If-None-Match header is highlighted.
Supported Browsers: The browsers are compatible with HTTP If-None-Match header are listefd below:
- Google Chrome
- Internet Explorer
- Mozilla Firefox
- Microsoft Edge