DELAPARRA
Index
Color
NL
Category: HTTP headers

Access-Control-Max-Age

Explained by Updated

What is Access-Control-Max-Age?

Access-Control-Max-Age: How long the browser may cache the preflight response. Avoids OPTIONS round trips. Access-Control-Max-Age tells the browser how long it may remember a preflight response, in seconds. During that time, repeated cross-origin requests skip the extra OPTIONS round trip. Without it, a browser may send a preflight before every single API call that needs one. On a busy single-page application, that can double the number of requests and add noticeable delay, especially on slow mobile connections.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Access-Control-Max-Age

What should you keep in mind with Access-Control-Max-Age?

A value of 600, ten minutes, is a reasonable default. Browsers cap it anyway; Chrome allows at most two hours. Set it once your CORS configuration is stable. While you are still changing allowed headers or methods, a long cache can make it look as if your changes had no effect, because the browser keeps using its remembered answer.

What does an example of Access-Control-Max-Age look like?

Access-Control-Max-Age: 600

At a glance

CategoryHTTP headers
Explained by
Updated

More HTTP headers terms

All terms starting with A

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.