对前端访问时跨域问题进行修改,允许跨域访问

This commit is contained in:
wanglei 2025-11-10 09:58:24 +08:00
parent ff0b020166
commit d315fa4ad2

View File

@ -52,6 +52,16 @@ http {
## 应用路径 todo 路径问题
set $APP_PATH '/home/frankly/work/AuthPlatform';
#访问时允许跨域处理
access_by_lua_block {
ngx.header["Access-Control-Allow-Origin"] = "*"
ngx.header["Access-Control-Allow-Methods"] = "GET, POST, DELETE, PUT"
ngx.header["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
if ngx.var.request_method == "OPTIONS" then
ngx.exit(ngx.HTTP_NOT_ALLOWED)
end
}
#数据列表配置
include 'system/system.conf';
@ -81,10 +91,10 @@ http {
}
}
server {
listen 9081 ssl http2;
server_name *.*;
ssl_certificate ssl/metroid.crt;
ssl_certificate_key ssl/metroid.key;
}
#server {
# listen 9081 ssl http2;
# server_name *.*;
# ssl_certificate ssl/metroid.crt;
# ssl_certificate_key ssl/metroid.key;
#}
}