- 排除网关逻辑错误的可能之后还是没加上对应的响应头?
- 解决(添加
* always
):
add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'Sec-Fetch-Mode,Accept,Accept-Encoding,Accept-Language,Connection,Host,Origin,Referer,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Length,Authorization';
add_header Access-Control-Expose-Headers 'Sec-Fetch-Mode,Accept,Accept-Encoding,Accept-Language,Connection,Host,Origin,Referer,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Length,Authorization';
if ($request_method = 'OPTIONS') {
return 204;
}