server {
add_header Access-Control-Allow-Origin *;
...
我就是这样加的
偶尔会这样
Access to XMLHttpRequest at '...' from origin '...' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
server {
add_header Access-Control-Allow-Origin *;
...
我就是这样加的
偶尔会这样
Access to XMLHttpRequest at '...' from origin '...' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
|
yoshiyukiMay 23, 2019
1
CORS 分简单和复杂两种情况
要么加了额外 header,要么带了 cookie,要么使用了 GET/POST 以外的 method,请自查 |
|
siMay 23, 2019
2
复杂请求还要做其他处理,详细情况你可以看看这个文章。
http://www.ruanyifeng.com/blog/2016/04/cors.html |
|
3
可能你的服务返回了 4**,5**等状态码
|
|
SparetireMay 23, 2019 via Android
4
CORS 是很多个头部配合使用的。。复杂情况这一个头部不够的
|
|
TakamineMay 23, 2019 via Android
5
这样不会不安全吗。_(:з」∠)_
|
|
ericguiMay 24, 2019
6
大概率是 Chrome 的锅
因为 chrome 会在某些时候给个 CORS error,实际上这是出于安全考虑,不给你发送实际的 error message 你应该用 postman 来查看真实的 error message |