diff --git a/nginx.conf.gateway b/nginx.conf.gateway index 1aedabb..0d467ea 100644 --- a/nginx.conf.gateway +++ b/nginx.conf.gateway @@ -85,10 +85,11 @@ http { proxy_ssl_session_reuse off; proxy_ssl_verify off; # 关键 2: 覆盖 Host 头,模拟 Vite 的 changeOrigin=true - proxy_set_header Host $proxy_host; # 设置为目标地址的 Host + proxy_set_header Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Host 106.52.199.114:8001; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $host:$server_port; + proxy_set_header Authorization $http_authorization; # 传递 Authorization 头 # 其他标准代理头 proxy_set_header X-Real-IP $remote_addr; @@ -106,10 +107,11 @@ http { proxy_ssl_session_reuse off; proxy_ssl_verify off; # 关键 2: 覆盖 Host 头,模拟 Vite 的 changeOrigin=true - proxy_set_header Host $proxy_host; # 设置为目标地址的 Host + proxy_set_header Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Host 106.52.199.114:8001; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $host:$server_port; + proxy_set_header Authorization $http_authorization; # 传递 Authorization 头 # 其他标准代理头 proxy_set_header X-Real-IP $remote_addr; @@ -122,7 +124,10 @@ http { location = /auth/.well-known/openid-configuration { proxy_pass https://sys_api/.well-known/openid-configuration; - + # 核心: + proxy_set_header Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Proto $scheme; # 动态修改返回的JSON中的URL proxy_set_header Accept-Encoding ""; sub_filter_types application/json; @@ -187,10 +192,10 @@ http { proxy_ssl_session_reuse off; proxy_ssl_verify off; # 关键 2: 覆盖 Host 头,模拟 Vite 的 changeOrigin=true - proxy_set_header Host $proxy_host; # 设置为目标地址的 Host - + proxy_set_header Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Host 106.52.199.114:8001; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $host:$server_port; + proxy_set_header Authorization $http_authorization; # 传递 Authorization 头 # 其他标准代理头 proxy_set_header X-Real-IP $remote_addr; @@ -202,7 +207,10 @@ http { } location = /auth/.well-known/openid-configuration { proxy_pass https://sys_api/.well-known/openid-configuration; - + + proxy_set_header Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Host 106.52.199.114:8001; + proxy_set_header X-Forwarded-Proto $scheme; # 动态修改返回的JSON中的URL proxy_set_header Accept-Encoding ""; sub_filter_types application/json;