if ($request_method = 'OPTIONS') {
            add_header 'access-control-allow-origin' '*' always;
            add_header 'access-control-allow-methods' 'GET, POST, PATCH, PUT, DELETE, OPTIONS' always;
            add_header 'access-control-allow-credentials' 'false' always; # origin不能为*
            add_header 'access-control-allow-headers' 'token, spread, authorization, content-type, if-match, if-modified-since, if-none-match, if-unmodified-since, x-csrf-token, x-requested-with' always;
            add_header 'access-control-max-age' '2592000' always;
            add_header 'content-type' 'text/plain';
            add_header 'content-length' 0;
            return 204;
        }

# 动态请求 的 请求ID, nginx传给PHP
fastcgi_param  logid $request_id;
# 动态请求 的 请求日志ID
add_header 'logid' $request_id always;

add_header upstream $upstream_addr always;
add_header 'access-control-allow-origin' '*' always;
add_header 'access-control-expose-headers' 'upstream, date, logid' always;

标签: none

添加新评论