diff --git a/agent/templates/nginx.conf.ejs b/agent/templates/nginx.conf.ejs index 5238054c..c57395a5 100644 --- a/agent/templates/nginx.conf.ejs +++ b/agent/templates/nginx.conf.ejs @@ -90,6 +90,7 @@ http { location /403.html { } location /404.html { } location /502.html { } + location /504.html { } location /auth-unavailable.html { } } @@ -141,6 +142,17 @@ http { proxy_pass http://error_pages; } + <%_ /* A frozen/paused or OOMing-but-alive upstream keeps the socket open + but never replies, so NGINX hits proxy_read_timeout and returns 504. */ -%> + error_page 504 @504; + location @504 { + rewrite ^ /504.html break; + proxy_method GET; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_pass http://error_pages; + } + <%_ if (httpServices.length === 0) { _%> location / { proxy_pass http://localhost:3000; @@ -210,6 +222,17 @@ http { proxy_pass http://error_pages; } + <%_ /* A frozen/paused or OOMing-but-alive upstream keeps the socket open + but never replies, so NGINX hits proxy_read_timeout and returns 504. */ -%> + error_page 504 @504; + location @504 { + rewrite ^ /504.html break; + proxy_method GET; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_pass http://error_pages; + } + <%_ if (authRequired && authServer) { _%> <%_ /* oauth2-proxy runs on its own address (this domain's "oauth2-proxy URL"). @@ -394,6 +417,17 @@ http { proxy_pass http://error_pages; } + <%_ /* A frozen/paused or OOMing-but-alive upstream keeps the socket open + but never replies, so NGINX hits proxy_read_timeout and returns 504. */ -%> + error_page 504 @504; + location @504 { + rewrite ^ /504.html break; + proxy_method GET; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_pass http://error_pages; + } + <%_ /* Serve documentation site statically */ -%> location / { root /opt/opensource-server/mie-opensource-landing/site; diff --git a/error-pages/502.html b/error-pages/502.html index 547c52b9..0a12bccd 100644 --- a/error-pages/502.html +++ b/error-pages/502.html @@ -130,7 +130,8 @@
- A service is configured for this hostname, but the upstream is not responding. + A service is configured for this hostname, but the upstream refused the + connection. The service is likely stopped or has crashed.
+ This service accepted the connection but did not respond in time. It is + likely paused or under heavy load — it should come back on its own shortly. +
+ +proxy_read_timeout) can end with this error.