nginx 配置允许跨域

2020-11-25  本文已影响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;   
}
上一篇 下一篇

猜你喜欢

热点阅读