美文网首页
nginx 配置允许跨域

nginx 配置允许跨域

作者: 小小码蚁 | 来源:发表于2020-11-25 11:26 被阅读0次
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;   
}

相关文章

网友评论

      本文标题:nginx 配置允许跨域

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