DevToolsmith

Access-Control-Max-Age Header

The Access-Control-Max-Age response header says how many seconds a browser may cache a preflight result.

Type
Response header
Category
CORS
Defined in
Fetch Standard

Syntax

Access-Control-Max-Age: <seconds>

How Access-Control-Max-Age works

Without it, browsers repeat the OPTIONS preflight before nearly every cross-origin request, doubling round trips. Browsers cap the value: Chrome at 2 hours (7200) and Firefox at 24 hours (86400), so larger numbers have no extra effect.

Examples

Cache preflights for two hours
Access-Control-Max-Age: 7200

Check it

curl -sI https://example.com | grep -i '^access-control-max-age:'

Paste a full set of response headers into the HTTP header checker to get every header explained and common mistakes flagged.

Related headers

More cors headers

Access-Control-Allow-Origin , Access-Control-Allow-Credentials , Access-Control-Expose-Headers , Origin .

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What does the Access-Control-Max-Age header do?

The Access-Control-Max-Age response header says how many seconds a browser may cache a preflight result. Without it, browsers repeat the OPTIONS preflight before nearly every cross-origin request, doubling round trips. Browsers cap the value: Chrome at 2 hours (7200) and Firefox at 24 hours (86400), so larger numbers have no extra effect.

How do I see the Access-Control-Max-Age header?

Run "curl -sI https://example.com" to print a response’s headers, or open the Network tab in your browser’s dev tools and select the request. Paste the headers into the HTTP header checker on this site to get each one explained.