路由规则调整

This commit is contained in:
yidl 2025-06-28 14:16:22 +08:00
parent 3fac72ea38
commit 14c4505670
1 changed files with 15 additions and 1 deletions

View File

@ -80,10 +80,24 @@ http {
proxy_set_header X-Forwarded-Host $host;
# --- 路由规则 (Locations) ---
# 1. 认证中心 (IdentityServer4) 路由 - 专门处理并移除 'auth' 前缀
# 匹配 /auth/ 开头的请求
location ~ ^/auth/ {
# rewrite 规则:
# ^/auth(/.*)$ : 匹配以 /auth 开头,并捕获 / 后面的所有路径到 \$1
# \$1 : 替换为 \$1即只保留 /auth 后面的路径
# break : 停止处理当前的 rewrite 规则,然后处理 proxy_pass
rewrite ^/auth(/.*)$ \$1 break;
proxy_pass https://auth_server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 1. 认证中心 (IdentityServer4) 路由
# 匹配所有认证相关的路径
location ~ ^/(auth|connect|Account|\\.well-known)/ {
location ~ ^/(connect|Account|\\.well-known)/ {
proxy_pass https://auth_server;
}