当前位置:Gxlcms > 数据库问题 > No 'Access-Control-Allow-Origin' header is present on the requested resource

No 'Access-Control-Allow-Origin' header is present on the requested resource

时间:2021-07-01 10:21:17 帮助过:30人阅读

一、现象

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

No 'Access-Control-Allow-Origin' header is present on the requested resource

标签:现象   ajax   tps   ade   access   control   错误   提示   例子   

人气教程排行