Nginx配置跨越支持
Niginx 配置 跨越支持
nginx.conf
nginx 主配置文件
map $http_origin $allow_origin {
default "";
~^https?://[^/]*\.realme\.net(:[0-9]+)?$ $http_origin;
~^https?://[^/]*\.realme\.com(:[0-9]+)?$ $http_origin;
}
ChatGPT4 对此的解释
web.conf
server 块中配置如下
add_header 'Access-Control-Allow-Origin' $allow_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;