# 设置允许跨域的域,* 表示允许任何域,也可以设置特定的域
add_header 'Access-Control-Allow-Origin' '*';
# 允许的方法
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# 允许的头信息字段(可也加入自定义的字段)
add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type,X-Requested-With';
# 缓存时间
add_header 'Access-Control-Max-Age' 1728000;
# 预检请求的处理
if ($request_method = 'OPTIONS') {return 204;
}
