Browse Source

Forward Host header to worker and server through NGINX

master
Rory Powell 5 years ago
parent
commit
0bf65376c3
  1. 6
      hosting/nginx.dev.conf.hbs
  2. 5
      hosting/nginx.prod.conf.hbs

6
hosting/nginx.dev.conf.hbs

@ -34,6 +34,7 @@ http {
location ~ ^/api/(system|admin|global)/ { location ~ ^/api/(system|admin|global)/ {
proxy_pass http://{{ address }}:4002; proxy_pass http://{{ address }}:4002;
proxy_set_header Host $host;
} }
location /api/ { location /api/ {
@ -41,24 +42,29 @@ http {
proxy_connect_timeout 120s; proxy_connect_timeout 120s;
proxy_send_timeout 120s; proxy_send_timeout 120s;
proxy_pass http://{{ address }}:4001; proxy_pass http://{{ address }}:4001;
proxy_set_header Host $host;
} }
location = / { location = / {
proxy_pass http://{{ address }}:4001; proxy_pass http://{{ address }}:4001;
proxy_set_header Host $host;
} }
location /app_ { location /app_ {
proxy_pass http://{{ address }}:4001; proxy_pass http://{{ address }}:4001;
proxy_set_header Host $host;
} }
location /app/ { location /app/ {
proxy_pass http://{{ address }}:4001; proxy_pass http://{{ address }}:4001;
rewrite ^/app/(.*)$ /$1 break; rewrite ^/app/(.*)$ /$1 break;
proxy_set_header Host $host;
} }
location /builder { location /builder {
proxy_pass http://{{ address }}:3000; proxy_pass http://{{ address }}:3000;
rewrite ^/builder(.*)$ /builder/$1 break; rewrite ^/builder(.*)$ /builder/$1 break;
proxy_set_header Host $host;
} }
location /builder/ { location /builder/ {

5
hosting/nginx.prod.conf.hbs

@ -68,10 +68,12 @@ http {
location /app { location /app {
proxy_pass http://$apps:4002; proxy_pass http://$apps:4002;
rewrite ^/app/(.*)$ /$1 break; rewrite ^/app/(.*)$ /$1 break;
proxy_set_header Host $host;
} }
location = / { location = / {
proxy_pass http://$apps:4002; proxy_pass http://$apps:4002;
proxy_set_header Host $host;
} }
{{#if watchtower}} {{#if watchtower}}
@ -87,15 +89,18 @@ http {
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$apps:4002; proxy_pass http://$apps:4002;
proxy_set_header Host $host;
} }
location ~ ^/api/(system|admin|global)/ { location ~ ^/api/(system|admin|global)/ {
proxy_pass http://$worker:4003; proxy_pass http://$worker:4003;
proxy_set_header Host $host;
} }
location /worker/ { location /worker/ {
proxy_pass http://$worker:4003; proxy_pass http://$worker:4003;
rewrite ^/worker/(.*)$ /$1 break; rewrite ^/worker/(.*)$ /$1 break;
proxy_set_header Host $host;
} }
location /api/ { location /api/ {

Loading…
Cancel
Save