今天项目中使用的前后端分离,前端使用Vue ,后端使用使用springbioot;

在同一台机器上调试,因为端口不一致出现错误axios Origin 'http://localhost:8080' is therefore not allowed access.

解决方案:服务器端配置跨域:

如图再springboot 的入口类 Application中做如下修改,即可:

spring boot 实现跨域访问

相关文章: