美文网首页
nginx调试设置,允许跨域

nginx调试设置,允许跨域

作者: dkzz | 来源:发表于2018-12-17 19:01 被阅读0次
      location / {
             if ($request_method = 'OPTIONS') {
                    add_header 'Access-Control-Allow-Origin' '*';
                    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
                    #
                    # Custom headers and headers various browsers *should* be OK with but aren't
                    #
                    add_header 'Access-Control-Allow-Headers' 'X-IPFSMAIN-TOKEN,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
            #
                    # Tell client that this pre-flight info is valid for 20 days
                    #
                    add_header 'Access-Control-Max-Age' 1728000;
                    add_header 'Content-Type' 'text/plain; charset=utf-8';
                    add_header 'Content-Length' 0;
                    return 204;
                 }
        }

    相关文章

      网友评论

          本文标题:nginx调试设置,允许跨域

          本文链接:https://www.haomeiwen.com/subject/yogckqtx.html