From 80726711e9a439c12dbf9c927a67f4b85c4ba49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=8A=E9=85=92?= Date: Fri, 10 Dec 2021 13:08:18 +0800 Subject: [PATCH] Update nginx.tmpl add proxy header "X-Forwarded-Host" --- nginx.tmpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nginx.tmpl b/nginx.tmpl index e79f790..c0c9ed0 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -55,6 +55,11 @@ map $http_x_forwarded_proto $proxy_x_forwarded_proto { '' $scheme; } +map $http_x_forwarded_host $proxy_x_forwarded_host { + default $http_x_forwarded_host; + '' $http_host; +} + # If we receive X-Forwarded-Port, pass it through; otherwise, pass along the # server port the client connected to map $http_x_forwarded_port $proxy_x_forwarded_port { @@ -111,6 +116,7 @@ proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $proxy_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header X-Forwarded-Host $proxy_x_forwarded_host; proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl; proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;