欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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
相关标签: nginx