From 5748690443878981b2da12d33ffb06b6d545342d Mon Sep 17 00:00:00 2001 From: yidl Date: Sun, 17 Aug 2025 22:58:11 +0800 Subject: [PATCH 1/2] host --- nginx.conf.gateway | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/nginx.conf.gateway b/nginx.conf.gateway index f547125..8ced89e 100644 --- a/nginx.conf.gateway +++ b/nginx.conf.gateway @@ -76,10 +76,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 X-Forwarded-Proto $scheme; + 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 Authorization $http_authorization; # 传递 Authorization 头 # 其他标准代理头 proxy_set_header X-Real-IP $remote_addr; @@ -97,10 +98,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 X-Forwarded-Proto $scheme; + 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 Authorization $http_authorization; # 传递 Authorization 头 # 其他标准代理头 proxy_set_header X-Real-IP $remote_addr; @@ -113,7 +115,10 @@ 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; @@ -178,10 +183,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 X-Forwarded-Proto $scheme; + 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 Authorization $http_authorization; # 传递 Authorization 头 # 其他标准代理头 proxy_set_header X-Real-IP $remote_addr; @@ -193,7 +198,10 @@ 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; From 0c008f42a4370784c632e956b7295ce751121c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E6=A0=8B=E6=A2=81?= Date: Wed, 20 Aug 2025 01:24:12 +0800 Subject: [PATCH 2/2] 106.52.199.114:8001; --- nginx.conf.gateway | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nginx.conf.gateway b/nginx.conf.gateway index 8ced89e..fba22c1 100644 --- a/nginx.conf.gateway +++ b/nginx.conf.gateway @@ -77,8 +77,8 @@ http { 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 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 Authorization $http_authorization; # 传递 Authorization 头 @@ -99,8 +99,8 @@ http { 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 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 Authorization $http_authorization; # 传递 Authorization 头 @@ -116,8 +116,8 @@ 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 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 ""; @@ -183,8 +183,8 @@ 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 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 Authorization $http_authorization; # 传递 Authorization 头 @@ -199,8 +199,8 @@ 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 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 "";