Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
报错如图:
数据是通过 配置跨域代理,和用 axios 请求的,本地运行项目数据都能正常接收到,但是一部署到服务器,数据就读取不到了。
devServer:{
proxy:{
'api':{
target:'http://39.98.123.211:8510',
changeOrigin: true,
// pathRewrite:{'^/api':''}
}
}
大家有没有遇到过这个问题,感谢 :)
这个应该只能解决本地跨域吧,服务器应该用服务器代理