This commit is contained in:
mei 2024-11-03 14:49:04 +08:00
parent 23bda4a56f
commit fbf2b43865

16
nginx-extra.conf Normal file
View File

@ -0,0 +1,16 @@
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;
}
## ...
}
## ...
}