ITeye博客

nginx配置跨域请求

vinnie424 · 2020-12-28 15:40 · Android · cordova · ios · nginx · 移动开发 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。