是否可以让浏览器缓存OPTIONS结果

时间:2015-08-13 18:32:08

标签: http cors

我试图让用户的浏览器在得知我的api服务器允许交叉原始请求后停止发出OPTIONS请求,但它似乎没有添加标准头部效果。有可能这样做吗?

Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Authorization,Content-Type,Request,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since
Access-Control-Allow-Methods:POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin:http://example.com
Cache-Control:max-age=31536000
Connection:keep-alive
Content-Length:0
Content-Type:text/plain charset=UTF-8
Date:Thu, 13 Aug 2015 18:25:42 GMT
Expires:Fri, 12 Aug 2016 18:25:42 GMT
Server:nginx/1.4.6 (Ubuntu)

1 个答案:

答案 0 :(得分:2)

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2

  

9.2选项
  [...]
  对此方法的响应不可缓存。