From d42bd66bd0f68b8467b0d2444cb1cdc307b6bff0 Mon Sep 17 00:00:00 2001 From: Thomas Fini Hansen Date: Thu, 12 Dec 2024 10:46:09 +0100 Subject: [PATCH] Pass hostname to proxied host --- context/nextjs/etc/nginx/templates/default.conf.template | 2 ++ context/proxy/etc/nginx/templates/default.conf.template | 5 ++++- context/storybook/etc/nginx/templates/default.conf.template | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/context/nextjs/etc/nginx/templates/default.conf.template b/context/nextjs/etc/nginx/templates/default.conf.template index c97eb43..be521b1 100644 --- a/context/nextjs/etc/nginx/templates/default.conf.template +++ b/context/nextjs/etc/nginx/templates/default.conf.template @@ -14,5 +14,7 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } diff --git a/context/proxy/etc/nginx/templates/default.conf.template b/context/proxy/etc/nginx/templates/default.conf.template index adabf1d..84f2ac0 100644 --- a/context/proxy/etc/nginx/templates/default.conf.template +++ b/context/proxy/etc/nginx/templates/default.conf.template @@ -5,6 +5,9 @@ server { root ${NGINX_DOCUMENT_ROOT}; location / { - proxy_pass ${NGINX_PROXY_PASS}; + proxy_pass ${NGINX_PROXY_PASS}; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } diff --git a/context/storybook/etc/nginx/templates/default.conf.template b/context/storybook/etc/nginx/templates/default.conf.template index c79c4f4..7e7ec07 100644 --- a/context/storybook/etc/nginx/templates/default.conf.template +++ b/context/storybook/etc/nginx/templates/default.conf.template @@ -14,6 +14,8 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /storybook-server-channel { @@ -22,5 +24,7 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }