请教一个 flask-cors 的跨域问题

2019-01-23 16:52:32 +08:00
 coolair
Access to XMLHttpRequest at 'http://test.lab:5000/image/2019-01-11-23-22-59.png' 
from origin 'http://a.test.lab:5000' has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' header is present on the requested resource.

在浏览器中禁用缓存 disabled cache 的时候,不会出现上面的错误。但是不禁用缓存就会报错。 使用了 flask 的 subdomain 特性,是同一个应用,用了不同的子域名。

有朋友知道怎么解决吗,已经使用了 flask-cors:

cors.init_app(app, supports_credentials=True)
627 次点击
所在节点    问与答
1 条回复
sunhk25
2020-03-07 20:21:34 +08:00
解决了吗,也遇到了类似的问题
不知如何设置允许子域名之间跨域,子域名和域名间跨域

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/529879

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX