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 1129467 of Access-Control-Max-Age

  • Revision slug: Web/HTTP/Headers/Access-Control-Max-Age
  • Revision title: Access-Control-Max-Age
  • Revision id: 1129467
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{HTTPSidebar}}

The Access-Control-Max-Age response header indicates how long the results of a preflight request (information contained in the {{HTTPHeader("Access-Control-Allow-Methods")}} and {{HTTPHeader("Access-Control-Allow-Headers")}} headers) can be cached.

Header type {{Glossary("Response header")}}
{{Glossary("Forbidden header name")}} no

Syntax

Access-Control-Max-Age: <delta-seconds>

Directives

<delta-seconds>
Number of seconds the results can be cached.
Firefox caps this at 24 hours (86400 seconds) and Chromium at 10 minutes (600 seconds). Chromium also specifies a default value of 5 seconds.

Examples

Cache results of a preflight request for 10 minutes:

Access-Control-Max-Age: 600 

Specifications

Specification Status Comment
{{SpecName('Fetch','http-access-control-max-age', 'Access-Control-Max-Age')}} {{Spec2("Fetch")}}  

Browser compatibility

{{Compat}}

See also

  • {{HTTPHeader("Access-Control-Allow-Headers")}}
  • {{HTTPHeader("Access-Control-Allow-Methods")}}

Revision Source

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

<p>The <strong><code>Access-Control-Max-Age</code></strong> response header indicates how long the results of a preflight request (information contained in the {{HTTPHeader("Access-Control-Allow-Methods")}} and {{HTTPHeader("Access-Control-Allow-Headers")}} headers) can be cached.</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("Response 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">
Access-Control-Max-Age: &lt;delta-seconds&gt;
</pre>

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

<dl>
 <dt>&lt;delta-seconds&gt;</dt>
 <dd>Number of seconds the results can be cached.<br />
 Firefox <a href="https://dxr.mozilla.org/mozilla-central/rev/7ae377917236b7e6111146aa9fb4c073c0efc7f4/netwerk/protocol/http/nsCORSListenerProxy.cpp#1131">caps this at 24 hours</a> (86400 seconds) and Chromium at <a href="https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp?rcl=1399481969&amp;l=44">10 minutes</a> (600 seconds). Chromium also specifies a default value of 5 seconds.</dd>
</dl>

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

<p>Cache results of a preflight request for 10 minutes:</p>

<pre>
Access-Control-Max-Age: 600 </pre>

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

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Fetch','http-access-control-max-age', 'Access-Control-Max-Age')}}</td>
   <td>{{Spec2("Fetch")}}</td>
   <td>&nbsp;</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("Access-Control-Allow-Headers")}}</li>
 <li>{{HTTPHeader("Access-Control-Allow-Methods")}}</li>
</ul>
Revert to this revision