From d7c8c69986b194c4ab3476da9fee426ad8604f9a Mon Sep 17 00:00:00 2001 From: yidl Date: Mon, 18 Aug 2025 12:01:15 +0800 Subject: [PATCH] Revert "host" This reverts commit 4bc72fbe57a868c72e9b23d1a3467ad7e7c24c6a. --- nginx.conf.gateway | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/nginx.conf.gateway b/nginx.conf.gateway index 8ced89e..f547125 100644 --- a/nginx.conf.gateway +++ b/nginx.conf.gateway @@ -76,11 +76,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 $host:$server_port; - proxy_set_header X-Forwarded-Host $host:$server_port; 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; @@ -98,11 +97,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 $host:$server_port; - proxy_set_header X-Forwarded-Host $host:$server_port; 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; @@ -115,10 +113,7 @@ http { location = /auth/.well-known/openid-configuration { proxy_pass https://sys_api/.well-known/openid-configuration; - # 核心: - proxy_set_header Host $host:$server_port; - proxy_set_header X-Forwarded-Host $host:$server_port; - proxy_set_header X-Forwarded-Proto $scheme; + # 动态修改返回的JSON中的URL proxy_set_header Accept-Encoding ""; sub_filter_types application/json; @@ -183,10 +178,10 @@ http { proxy_ssl_session_reuse off; proxy_ssl_verify off; # 关键 2: 覆盖 Host 头,模拟 Vite 的 changeOrigin=true - proxy_set_header Host $host:$server_port; - proxy_set_header X-Forwarded-Host $host:$server_port; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $proxy_host; # 设置为目标地址的 Host + 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; @@ -198,10 +193,7 @@ http { } location = /auth/.well-known/openid-configuration { proxy_pass https://sys_api/.well-known/openid-configuration; - - proxy_set_header Host $host:$server_port; - proxy_set_header X-Forwarded-Host $host:$server_port; - proxy_set_header X-Forwarded-Proto $scheme; + # 动态修改返回的JSON中的URL proxy_set_header Accept-Encoding ""; sub_filter_types application/json;