Access-Control-Max-Age
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Access-Control-Max-Age
响应标头指示了预检请求(即包含在 Access-Control-Allow-Methods
和 Access-Control-Allow-Headers
标头中的信息)的结果能够被缓存多久。
语法
http
Access-Control-Max-Age: <delta-seconds>
指令
- <delta-seconds>
-
结果可被缓存的最大秒数,以无符号非负整数表示。Firefox 上限为 24 小时(86400 秒)。Chromium(76 版本之前)上限为 10 分钟(600 秒)。Chromium(从 76 版本开始)上限为 2 小时(7200 秒)。默认值为 5 秒。
示例
将预检请求的结果缓存 10 分钟:
http
Access-Control-Max-Age: 600
规范
Specification |
---|
Fetch # http-access-control-max-age |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Access-Control-Max-Age |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.