nginx配置跨域:
location里面添加:
if ($request_method = ‘OPTIONS’) {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods OPTIONS,HEAD,GET,POST,DELETE,PUT,PATCH;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Max-Age 1728000;
add_header Access-Control-Allow-Headers authorization,content-type,x-requested-with,Accept,Authorization,Origin,Referer,X-Csrf-Token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type;
return 200;
}
nginx配置跨域
最新推荐文章于 2024-04-19 08:56:48 发布