From 0bf65376c3ca409653ef99a7665f656220e657c4 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 21 Feb 2022 10:22:26 +0000 Subject: [PATCH] Forward Host header to worker and server through NGINX --- hosting/nginx.dev.conf.hbs | 6 ++++++ hosting/nginx.prod.conf.hbs | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs index 2bf5c0e4b6..028d9c58ea 100644 --- a/hosting/nginx.dev.conf.hbs +++ b/hosting/nginx.dev.conf.hbs @@ -34,6 +34,7 @@ http { location ~ ^/api/(system|admin|global)/ { proxy_pass http://{{ address }}:4002; + proxy_set_header Host $host; } location /api/ { @@ -41,24 +42,29 @@ http { proxy_connect_timeout 120s; proxy_send_timeout 120s; proxy_pass http://{{ address }}:4001; + proxy_set_header Host $host; } location = / { proxy_pass http://{{ address }}:4001; + proxy_set_header Host $host; } location /app_ { proxy_pass http://{{ address }}:4001; + proxy_set_header Host $host; } location /app/ { proxy_pass http://{{ address }}:4001; rewrite ^/app/(.*)$ /$1 break; + proxy_set_header Host $host; } location /builder { proxy_pass http://{{ address }}:3000; rewrite ^/builder(.*)$ /builder/$1 break; + proxy_set_header Host $host; } location /builder/ { diff --git a/hosting/nginx.prod.conf.hbs b/hosting/nginx.prod.conf.hbs index 56ea7d2171..02ff9f0c7b 100644 --- a/hosting/nginx.prod.conf.hbs +++ b/hosting/nginx.prod.conf.hbs @@ -68,10 +68,12 @@ http { location /app { proxy_pass http://$apps:4002; rewrite ^/app/(.*)$ /$1 break; + proxy_set_header Host $host; } location = / { proxy_pass http://$apps:4002; + proxy_set_header Host $host; } {{#if watchtower}} @@ -87,15 +89,18 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://$apps:4002; + proxy_set_header Host $host; } location ~ ^/api/(system|admin|global)/ { proxy_pass http://$worker:4003; + proxy_set_header Host $host; } location /worker/ { proxy_pass http://$worker:4003; rewrite ^/worker/(.*)$ /$1 break; + proxy_set_header Host $host; } location /api/ {