在前后端分离开发的时候,经常会遇到后端自己能调通接口,使用postman等测试工具访问也没有问题,但是在页面请求的时候会出现跨域访问问题:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:18080' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
解决方法: