[vue报错]has been blocked by CORS policy

原创
2019/01/08 09:13
阅读数 13.5W
:8080/#/setMealDetail?goodsId=36363684365:1 Access to XMLHttpRequest at 
'http://132.121.80.202:8080/app-web/woapp/v18/store/simCard/package4GUniversal/goodsDetail.do' 
from origin 'http://130.51.23.17:8080' has been blocked by CORS policy: 
The 'Access-Control-Allow-Origin' header contains the invalid value '0'.
  • 解决: nginx.conf增加配置
http {
	include       mime.types;
  add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  add_header 'Access-Control-Allow-Credentials' 'true';
  default_type  application/octet-stream;

  map $http_origin $corsHost {
		"~http://130.51.23.17:8080" http://130.51.23.17:8080;
	}
}
展开阅读全文
打赏
1
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
1
分享
返回顶部
顶部