Open In App

HTTP headers | If-None-Match

Last Updated : 18 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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.

    Syntax:

    If-None-Match: "entity_tag"
    If-None-Match: *

    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.

    Examples:

    • If-None-Match:"2780-5524acffbda80-gzip"
    • If-None-Match:*

    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
    • Opera
    • Safari

    Like Article
    Suggest improvement
    Share your thoughts in the comments

Similar Reads