nginx配置跨域请求
程序员文章站
2022-03-19 16:45:34
...
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
if ($request_method = 'OPTIONS') {
return 204;
}
}
源自:
https://segmentfault.com/a/1190000012550346
https://www.cnblogs.com/yibinboy/p/12872890.html
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
if ($request_method = 'OPTIONS') {
return 204;
}
}
源自:
https://segmentfault.com/a/1190000012550346
https://www.cnblogs.com/yibinboy/p/12872890.html
上一篇: 螺蛳粉很臭吗?螺蛳粉什么品牌最正宗?
下一篇: 站长推广思路 免费策略营销