16 lines
587 B
Plaintext
16 lines
587 B
Plaintext
server {
|
|
## ...
|
|
location ~ [^/]\.php(/|$) {
|
|
# 添加CORS头部
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
|
add_header 'Access-Control-Max-Age' 1728000 always;
|
|
# 处理预检请求
|
|
if ($request_method = 'OPTIONS' ) {
|
|
return 204;
|
|
}
|
|
## ...
|
|
}
|
|
## ...
|
|
} |