Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1111795 of If-Unmodified-Since

  • Revision slug: Web/HTTP/Headers/If-Unmodified-Since
  • Revision title: If-Unmodified-Since
  • Revision id: 1111795
  • Created:
  • Creator: fscholz
  • Is current revision? Yes
  • Comment fix github url

Revision Content

{{HTTPSidebar}}

The If-Unmodified-Since request HTTP header makes the request conditional: the server will send back the requested resource, or accept it in the case of a {{HTTPMethod("POST")}} or another non-{{Glossary("safe")}} method, only if it has not been last modified after the given date. If the request has been modified after the given date, the response will be a {{HTTPStatus("412")}} (Precondition Failed) error.

There are two common use cases:

  • In conjunction non-{{Glossary("safe")}} methods, like {{HTTPMethod("POST")}}, it can be used to implement an optimistic concurrency control, like done by some wikis: editions are rejected if the stored document has been modified since the original has been retrieved.
  • In conjunction with a range request with a {{HTTPHeader("If-Range")}} header, it can be used to ensure that the new fragment requested comes from an unmodified document.
Header type {{Glossary("Request header")}}
{{Glossary("Forbidden header name")}} no

Syntax

If-Unmodified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT

Directives

<day-name>
One of "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", or "Sun" (case-sensitive).
<day>
2 digit day number, e.g. "04" or "23".
<month>
One of "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" (case sensitive).
<year>
4 digit year number, e.g. "1990" or "2016".
<hour>
2 digit hour number, e.g. "09" or "23".
<minute>
2 digit minute number, e.g. "04" or "59".
<second>
2 digit second number, e.g. "04" or "59".
GMT

Greenwich Mean Time. HTTP dates are always expressed in GMT, never in local time.

Examples

If-Unmodified-Since: Wed, 21 Oct 2015 07:28:00 GMT 

Specifications

Specification Title
{{RFC("7232", "If-Unmodified-Since", "3.4")}} Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests

Browser compatibility

{{Compat}}

See also

  • {{HTTPHeader("If-Unmodified-since")}}
  • {{HTTPHeader("If-Match")}}
  • {{HTTPHeader("If-None-Match")}}
  • {{HTTPHeader("If-Range")}}
  • {{HTTPStatus("412")}} Precondition Failed

Revision Source

<div>{{HTTPSidebar}}</div>

<p>The <strong><code>If-Unmodified-Since</code></strong> request HTTP header makes the request conditional: the server will send back the requested resource, or accept it in the case of a {{HTTPMethod("POST")}} or another non-{{Glossary("safe")}} method, only if it has not been last modified after the given date. If the request has been modified after the given date, the response will be a {{HTTPStatus("412")}} (Precondition Failed) error.</p>

<p>There are two common use cases:</p>

<ul>
 <li>In conjunction non-{{Glossary("safe")}} methods, like {{HTTPMethod("POST")}}, it can be used to implement an <a href="https://en.wikipedia.org/wiki/Optimistic_concurrency_control">optimistic concurrency control</a>, like done by some wikis: editions are rejected if the stored document has been modified since the original has been retrieved.</li>
 <li>In conjunction with a range request with a {{HTTPHeader("If-Range")}} header, it can be used to ensure that the new fragment requested comes from an unmodified document.</li>
</ul>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("Request header")}}</td>
  </tr>
  <tr>
   <th scope="row">{{Glossary("Forbidden header name")}}</th>
   <td>no</td>
  </tr>
 </tbody>
</table>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">
If-Unmodified-Since: &lt;day-name&gt;, &lt;day&gt; &lt;month&gt; &lt;year&gt; &lt;hour&gt;:&lt;minute&gt;:&lt;second&gt; GMT
</pre>

<h2 id="Directives">Directives</h2>

<dl>
 <dt>&lt;day-name&gt;</dt>
 <dd>One of "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", or "Sun" (case-sensitive).</dd>
 <dt>&lt;day&gt;</dt>
 <dd>2 digit day number, e.g. "04" or "23".</dd>
 <dt>&lt;month&gt;</dt>
 <dd>One of "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" (case sensitive).</dd>
 <dt>&lt;year&gt;</dt>
 <dd>4 digit year number, e.g. "1990" or "2016".</dd>
 <dt>&lt;hour&gt;</dt>
 <dd>2 digit hour number, e.g. "09" or "23".</dd>
 <dt>&lt;minute&gt;</dt>
 <dd>2 digit minute number, e.g. "04" or "59".</dd>
 <dt>&lt;second&gt;</dt>
 <dd>2 digit second number, e.g. "04" or "59".</dd>
 <dt><code>GMT</code></dt>
 <dd>
 <p>Greenwich Mean Time. HTTP dates are always expressed in GMT, never in local time.</p>
 </dd>
</dl>

<h2 id="Examples">Examples</h2>

<pre>
If-Unmodified-Since: Wed, 21 Oct 2015 07:28:00 GMT 
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Title</th>
  </tr>
  <tr>
   <td>{{RFC("7232", "If-Unmodified-Since", "3.4")}}</td>
   <td>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{HTTPHeader("If-Unmodified-since")}}</li>
 <li>{{HTTPHeader("If-Match")}}</li>
 <li>{{HTTPHeader("If-None-Match")}}</li>
 <li>{{HTTPHeader("If-Range")}}</li>
 <li>{{HTTPStatus("412")}}<code> Precondition Failed</code></li>
</ul>
Revert to this revision