最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Control

运维笔记admin12浏览0评论

Control

Control

Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed aess 1.问题背景

练手过程中,尝试使用前后端分离的技术,但不幸测试界面使用时便出错

2.问题原因 跨域请求,后端不允许

可能原因,你的后台代码中没有配置相关设置,导致其默认阻止其他域的访问

我的后台使用的是springMVC模式

但是没有相关配置

3.解决办法

方法一,给后端加过滤器,设置相关属性

方法二,我的处理办法是在控制器中添加注解,@CrossOrigin

@CrossOrigin@.springframework.stereotype.Controllerpublic class UserController implements Controller { ... }

Control

发布评论

评论列表(0)

  1. 暂无评论