[vue报错]has been blocked by CORS policy

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

: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;
	}
}

转载于:https://my.oschina.net/u/2464371/blog/2998554

你可能感兴趣的:([vue报错]has been blocked by CORS policy)