CORS Access-Control-Max-Age 被忽略 [英] CORS Access-Control-Max-Age is ignored

查看:29
本文介绍了CORS Access-Control-Max-Age 被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在不同的域上托管一个 WebApp 和他的 API,并使用 CORS 来解决同一个源策略.到现在为止还挺好.这有效.

I'm hosting an WebApp and his API on different domains and use CORS to be able to work around the same origin policy. So far, so good. This works.

为了每个会话只发送一次 CORS 预检,我设置了Access-Control-Max-Age 到 20 天,但这不起作用(在 Chrome 中测试):https://db.tt/vfIW3fD2

To only send a CORS preflight once per session I set the Access-Control-Max-Age to 20 days, But this is not working (tested in Chrome): https://db.tt/vfIW3fD2

我需要改变什么?

推荐答案

如果您使用的是 Chrome Dev Tools,请确保禁用缓存(DevTools 打开时)"未选中.我遇到了Access-Control-Max-Age"的问题,但我意识到我选中了该选项而没有荣幸.

If you are using Chrome Dev Tools, make sure you have "Disable cache (while DevTools is open)" unchecked. I was having issues with the "Access-Control-Max-Age" not being honored only to realize that I had that option checked.

这篇关于CORS Access-Control-Max-Age 被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆