-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
跨域请求使用 resCors 的问题 #271
Comments
先用 Chrome 插件 Allow CORS 顶了一下,也挺方便 |
我这边也是 OPTIONS 请求返回了 403,提示:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
为了方便前端开发,项目直接连线上测试库进行调试。使用的是 Axios 进行请求,按照 文档 里添加了两条属性到 keys 里,结果发现 header 并非自己所要的 response 字段:
当前的响应头部:
access-control-allow-origin: *
access-control-expose-headers: *
期望的响应头部:
access-control-allow-origin: *
access-control-allow-headers: *
因为不能设置 ,所以 Chrome 一直在 OPTION 阶段就中止了请求了:
Access to XMLHttpRequest at 'http://[ONLINE_DEV_SERVER]' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field x-requested-with is not allowed by Access-Control-Allow-Headers in preflight response.
请问大大有什么解决方法,谢谢了!
The text was updated successfully, but these errors were encountered: