From 6612cad91f0212fca77e82eed602d372437c54c4 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 13 Oct 2022 11:26:25 +0100 Subject: [PATCH] Add additional timeout configuration to nginx.dev.conf.hbs --- hosting/nginx.dev.conf.hbs | 66 ++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs index 14c32b1bba..39a8dc52af 100644 --- a/hosting/nginx.dev.conf.hbs +++ b/hosting/nginx.dev.conf.hbs @@ -24,6 +24,21 @@ http { default "upgrade"; } + upstream app-service { + server {{address}}:4001; + keepalive 32; + } + + upstream worker-service { + server {{address}}:4002; + keepalive 32; + } + + upstream builder { + server {{address}}:3000; + keepalive 32; + } + server { listen 10000 default_server; server_name _; @@ -43,45 +58,78 @@ http { } location ~ ^/api/(system|admin|global)/ { - proxy_pass http://{{ address }}:4002; + proxy_pass http://worker-service; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; + proxy_http_version 1.1; + proxy_set_header Connection ""; } location /api/ { proxy_read_timeout 120s; proxy_connect_timeout 120s; proxy_send_timeout 120s; - proxy_pass http://{{ address }}:4001; + proxy_pass http://app-service; + proxy_http_version 1.1; + proxy_set_header Connection ""; } location = / { - proxy_pass http://{{ address }}:4001; + proxy_pass http://app-service; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; + proxy_http_version 1.1; + proxy_set_header Connection ""; } location /app_ { - proxy_pass http://{{ address }}:4001; + proxy_pass http://app-service; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; + proxy_http_version 1.1; + proxy_set_header Connection ""; } location /app { - proxy_pass http://{{ address }}:4001; + proxy_pass http://app-service; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; + proxy_http_version 1.1; + proxy_set_header Connection ""; } location /builder { - proxy_pass http://{{ address }}:3000; + proxy_pass http://builder; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; + proxy_http_version 1.1; + proxy_set_header Connection ""; rewrite ^/builder(.*)$ /builder/$1 break; } location /builder/ { - proxy_pass http://{{ address }}:3000; + proxy_pass http://builder; proxy_http_version 1.1; proxy_set_header Connection $connection_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; } location /vite/ { - proxy_pass http://{{ address }}:3000; + proxy_pass http://builder; + proxy_read_timeout 120s; + proxy_connect_timeout 120s; + proxy_send_timeout 120s; rewrite ^/vite(.*)$ /$1 break; } @@ -91,7 +139,7 @@ http { proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; - proxy_pass http://{{ address }}:4001; + proxy_pass http://app-service; } location / {