[vue報錯]has been blocked by CORS policy

: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;
	}
}
相關文章
相關標籤/搜索