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.

    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


    My Personal Notes arrow_drop_up

    Check out this Author's contributed articles.

    If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




    Article Tags :

    Be the First to upvote.


    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.