No 'Access-Control-Allow-Origin' header is present on the requested resource
2017-07-01 23:02
429 查看
一、现象
ajax调用请求后,前端提示收到这个错误
No 'Access-Control-Allow-Origin' header is present on the requested resource
二、原因
这是一个典型的跨域请求失败的例子。
三、解决
服务器的响应消息中增加头字段即可。
rsp.addHeader("Access-Control-Allow-Origin", "*");
四、扩展
更多的关于CORS的内容可以学习这篇文章:
https://yq.aliyun.com/articles/69313
ajax调用请求后,前端提示收到这个错误
No 'Access-Control-Allow-Origin' header is present on the requested resource
二、原因
这是一个典型的跨域请求失败的例子。
三、解决
服务器的响应消息中增加头字段即可。
rsp.addHeader("Access-Control-Allow-Origin", "*");
四、扩展
更多的关于CORS的内容可以学习这篇文章:
https://yq.aliyun.com/articles/69313
相关文章推荐
- 解决Tomcat错误信息:No 'Access-Control-Allow-Origin' header is present on the requested resource | Solving Tomcat Error: No 'Access-Control-Allow-Origin' header is present on the requested resource
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- (转)AJax跨域:No 'Access-Control-Allow-Origin' header is present on the requested resource
- ajax跨域(No 'Access-Control-Allow-Origin' header is present on the requested resource)
- ABP PUT、DELETE请求错误405.0 - Method Not Allowed 因为使用了无效方法(HTTP 谓词) 引发客户端错误 No 'Access-Control-Allow-Origin' header is present on the requested resource
- 解决Vue请求 ‘No 'Access-Control-Allow-Origin' header is present on the requested resource’错误
- 黄聪:No 'Access-Control-Allow-Origin' header is present on the requested resource解决办法
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- 跨域问题:No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案
- No 'Access-Control-Allow-Origin' header is present on the requested resource
- js跨域访问,no 'access-control-allow-origin' header is present on the requested resource
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource
- No 'Access-Control-Allow-Origin' header is present on the requested resource. 报错解决。
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore no