nginx 配置跨域

 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;
    }
        proxy_pass http://localhost:60877/;
            root   html;
            index  index.html index.htm;
        }            

猜你喜欢

转载自www.cnblogs.com/jasonbourne3/p/11870726.html
今日推荐