From b35235f1e9c84d2b94e9eefbaa409cec9cd57d89 Mon Sep 17 00:00:00 2001 From: Alexy Mikhailichenko Date: Mon, 1 Jul 2019 14:14:34 -0400 Subject: [PATCH 1/4] Change 502 error page to automatically refresh if backend status changes --- plugins/nginx-vhosts/templates/502-error.html | 64 +++++++++++++++++++ .../nginx-vhosts/templates/nginx.conf.sigil | 8 ++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 plugins/nginx-vhosts/templates/502-error.html diff --git a/plugins/nginx-vhosts/templates/502-error.html b/plugins/nginx-vhosts/templates/502-error.html new file mode 100644 index 000000000..0390baaa8 --- /dev/null +++ b/plugins/nginx-vhosts/templates/502-error.html @@ -0,0 +1,64 @@ + + + + We're sorry, but something went wrong (500) + + + + + + + +
+

We're sorry, but something went wrong.

+

If you are the application owner check the logs for more information.

+
+ + diff --git a/plugins/nginx-vhosts/templates/nginx.conf.sigil b/plugins/nginx-vhosts/templates/nginx.conf.sigil index 360ba4a6a..e67ba75e3 100644 --- a/plugins/nginx-vhosts/templates/nginx.conf.sigil +++ b/plugins/nginx-vhosts/templates/nginx.conf.sigil @@ -105,11 +105,17 @@ server { internal; } - error_page 500 501 502 503 504 505 506 507 508 509 510 511 /500-error.html; + error_page 500 501 503 504 505 506 507 508 509 510 511 /500-error.html; location /500-error.html { root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors; internal; } + + error_page 502 /502-error.html; + location /502-error.html { + root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors; + internal; + } } {{ end }}{{ end }} From 75036dfa2752e6e3fa3d808a4bb105b8732a0fdc Mon Sep 17 00:00:00 2001 From: Alexy Mikhailichenko Date: Mon, 1 Jul 2019 14:24:36 -0400 Subject: [PATCH 2/4] Remove console calls --- plugins/nginx-vhosts/templates/502-error.html | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/nginx-vhosts/templates/502-error.html b/plugins/nginx-vhosts/templates/502-error.html index 0390baaa8..6b6693cee 100644 --- a/plugins/nginx-vhosts/templates/502-error.html +++ b/plugins/nginx-vhosts/templates/502-error.html @@ -43,7 +43,6 @@ retry_current *= 2; } - console.dir('Trying', window.location.href, 'in', retry_current, 'seconds...'); setTimeout(check_gateway, retry_current * 1000); } }; From a496ae987af4fcbb36fc5c202ce78d5a2961ac13 Mon Sep 17 00:00:00 2001 From: Alexy Mikhailichenko Date: Mon, 1 Jul 2019 17:10:45 -0400 Subject: [PATCH 3/4] Remove console calls --- plugins/nginx-vhosts/templates/502-error.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/nginx-vhosts/templates/502-error.html b/plugins/nginx-vhosts/templates/502-error.html index 6b6693cee..fba8b3e04 100644 --- a/plugins/nginx-vhosts/templates/502-error.html +++ b/plugins/nginx-vhosts/templates/502-error.html @@ -34,8 +34,6 @@ request.onload = function () { - console.dir(window.location.href, 'returned', request.status); - if (request.status >= 200 && request.status < 400) { window.location.reload(true); } else { From c99f92e9f2cf86fadc748d85efd219e7174e1532 Mon Sep 17 00:00:00 2001 From: Alexy Mikhailichenko Date: Mon, 1 Jul 2019 17:17:14 -0400 Subject: [PATCH 4/4] Change 500 to 502 --- plugins/nginx-vhosts/templates/502-error.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/templates/502-error.html b/plugins/nginx-vhosts/templates/502-error.html index fba8b3e04..45640345d 100644 --- a/plugins/nginx-vhosts/templates/502-error.html +++ b/plugins/nginx-vhosts/templates/502-error.html @@ -1,7 +1,7 @@ - We're sorry, but something went wrong (500) + We're sorry, but something went wrong (502)