Open In App

HTTP headers | If-Match

Improve
Improve
Like Article
Like
Save
Share
Report

The HTTP headers If-Match is request-type header. It is used to make the request conditional. If it matches one of the listed conditional ETags then the server will send back the requested resource for PUT and other non-safe methods, it will only upload the resource in this case.

This ETag header uses a string comparison algorithm. Using this header are two common use cases:

  • it can ensure that the modern ranges requested comes from the same resource than the past one. For GET and HEAD methods, utilized in combination with a Run header.if at a point a 416 (Range Not Satisfiable) reaction is returned, then it doesn’t coordinate.
  • If-Match can be utilized to anticipate the misplaced upgrade issue, For other methods, and in specific for PUT. It can check in case the alteration of a resource that the client needs to transfer will not override another alter that has been done since the first resource was gotten. the 412 (Precondition Fizzled) response is returned if the response is not requested.

Syntax

If-Match:<*;
If-Match:<etag_value>, <etag_value>, ...

Directives: This header accept two directives as mentioned above and described below:

  • <etag_value> This directive holds the value of the Etag list, values are in form of string of ASCII characters placed between double quotes. Used prefixed by W/ to indicate that they are “weak”.
  • *:
  • The asterisk directive could be a special value representing a resource.

Examples:

If-Match: *
If-Match: "afyr456nfk560hfef5bhoy007dfhgfd9h"

To check the HTTP headers If-Match in action go to Inspect Element -> Network check the request header

Supported Browsers: The browsers are compatible with HTTP header If-Match are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari
  • Microsoft Edge

Last Updated : 21 May, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads