nginx配置跨域请求 博客分类: iosnginxcordovaAndroid nginx
程序员文章站
2024-02-07 13:36:04
...
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
推荐阅读
-
nginx配置跨域请求 博客分类: iosnginxcordovaAndroid nginx
-
nginx防止DDOS攻击配置 博客分类: Nginx nginxddoscc攻击
-
nginx防止DDOS攻击配置(2) 博客分类: Nginx nginx
-
nginx防止DDOS攻击配置 博客分类: Nginx nginxddoscc攻击
-
通过nginx实现跨域请求
-
nginx配置跨域设置
-
深入浅析Nginx实现AJAX跨域请求问题
-
nginx服务器配置解决ajax的跨域问题
-
Nginx实现AJAX跨域请求图文详解(附代码)
-
《React后台管理系统实战:十五》项目部署:跨域和非跨域部署,nginx的配置