From 63dbf760350140dc87ed6c6f8e75775a0f2142bc Mon Sep 17 00:00:00 2001 From: Dom Sekotill Date: Thu, 19 Mar 2020 19:19:08 +0000 Subject: [PATCH 1/2] Add a 502 (service unavailable) error page w/ self reloading --- Dockerfile | 1 + data/502.html | 91 +++++++++++++++++++++++++++++++++++++++++++++++++ data/nginx.conf | 7 ++++ 3 files changed, 99 insertions(+) create mode 100644 data/502.html diff --git a/Dockerfile b/Dockerfile index 61f1816..000db5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ ARG nginx_version=latest FROM nginx:${nginx_version} as nginx LABEL uk.org.kodo.maintainer = "Dom Sekotill " COPY data/nginx.conf /etc/nginx/conf.d/default.conf +COPY data/5*.html /app/html/ FROM php:7.3-fpm-alpine as deps diff --git a/data/502.html b/data/502.html new file mode 100644 index 0000000..fa3983e --- /dev/null +++ b/data/502.html @@ -0,0 +1,91 @@ + + + + + + + + + + Site Unavailable + + + + + + +
+
+ +
+
+

Site Unavailable

+

This site is currently unavailable

+ +
+
+ +
+
+ + + diff --git a/data/nginx.conf b/data/nginx.conf index 551a927..d07c4c9 100644 --- a/data/nginx.conf +++ b/data/nginx.conf @@ -25,6 +25,13 @@ server { # Add Cache-Control headers for static files, removed in *.php location add_header Cache-Control "public, max-age=7776000, stale-while-revalidate=86400, stale-if-error=604800"; + error_page 502 /errors/502.html; + + location /errors { + alias /app/html; + internal; + } + location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /app$fastcgi_script_name; -- GitLab From 0f55a4a8364f078171b414535fc3c4befdf467a1 Mon Sep 17 00:00:00 2001 From: Dom Sekotill Date: Thu, 19 Mar 2020 19:30:35 +0000 Subject: [PATCH 2/2] Wrap the HTTP-502 AJAX in a Promise --- data/502.html | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/data/502.html b/data/502.html index fa3983e..3e72206 100644 --- a/data/502.html +++ b/data/502.html @@ -11,6 +11,21 @@