vue-resource请求node.js接口时出现跨域问题No Access-Control-Allow-Origin header is present on the requested
2020-07-18 04:58
941 查看
vue-resource请求node.js接口时出现跨域问题No ‘Access-Control-Allow-Origin’
- 下面通过一个简单的例子说明解决办法
- vue-resource请求node.js接口
- 解决办法,在node代码添加以下代码,设置头部即可
res.writeHead(200, {'Content-Type':'text/json;charset=utf-8','Access-Control-Allow-Origin':'*'});
- 显示结果
相关文章推荐
- 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”
- 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.
- VUE axios 跨域问题 No 'Access-Control-Allow-Origin' header is present on the requested resource.
- AJAX跨越、JS跨越请求 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin
- 解决 js ajax跨域访问报“No 'Access-Control-Allow-Origin' header is present on the requested resource.”错误
- 解决 js ajax跨域访问报“No 'Access-Control-Allow-Origin' header is present on the requested resource.”错误
- Tomcat的webservice接口访问报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.
- 跨域 No 'Access-Control-Allow-Origin' header is present on the requested resource
- 解决 js ajax跨域访问报“No 'Access-Control-Allow-Origin' header is present on the requested resource.”错误
- 调用其他服务器的api时,暂时处理跨域问题的方法——No 'Access-Control-Allow-Origin' header is present on the requested resour
- 解决 ajax跨域 No 'Access-Control-Allow-Origin' header is present on the requested resource.
- vue axios 遇到“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 'null' is there
- “No 'Access-Control-Allow-Origin' header is present on the requested resource”