HTTP参考手册
标题 | Headers
Access-Control-Max-Age
Access-Control-Max-Age
响应 header 指示多长时间的结果预检请求(即包含在所述信息Access-Control-Allow-Methods
和Access-Control-Allow-Headers
的 headers )可以被缓存。
Header type |
Response header |
---|---|
Forbidden header name |
no |
语法
Access-Control-Max-Age: <delta-seconds>
指令
<delta-seconds> 结果可以被缓存的最大秒数。
Firefox 在24小时(86400秒)和10分钟(600秒)的 Chromium 上限。Chromium 还指定了5秒的默认值。
值为-1将禁用缓存,需要对所有呼叫进行预检选项检查。
例子
将预检请求的结果缓存10分钟:
Access-Control-Max-Age: 600
规范
Specification |
Status |
Comment |
---|---|---|
FetchThe definition of 'Access-Control-Max-Age' in that specification. |
Living Standard |
Initial definition. |
浏览器兼容性
Feature |
Chrome |
Firefox |
Edge |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|---|
Basic Support |
4 |
3.5 |
12 |
10 |
12 |
4 |
Feature |
Android |
Chrome for Android |
Edge mobile |
Firefox for Android |
IE mobile |
Opera Android |
iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support |
2.1 |
(Yes) |
(Yes) |
1.0 |
(Yes) |
12 |
3.2 |