关于nginx:解决-nginx-跨域-问题

3次阅读

共计 301 个字符,预计需要花费 1 分钟才能阅读完成。

在 nginx 的配置文件中减少:

location / {
  add_header Access-Control-Allow-Origin $http_origin;
  add_header Access-Control-Allow-Methods 'GET,POST,OPTIONS';
  add_header Access-Control-Allow-Credentials true;
  add_header Access-Control-Allow-Headers *;
  add_header Access-Control-Max-Age 1728000;
  if ($request_method = 'OPTIONS') {return 204;}
}
正文完
 0