diff --git a/nginx/maintenance.html b/nginx/maintenance.html
new file mode 100644
index 0000000..ad460cd
--- /dev/null
+++ b/nginx/maintenance.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+ Be right back | Goodwalk
+
+
+
+
+
+
+
+
+ Goodwalk
+ Be right back!
+ We're updating the site — should only take a minute. Thanks for your patience.
+
+
+
+
+
+
+
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index 371ee75..456d1e4 100644
--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -29,6 +29,14 @@ server {
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
+ # Served when the SvelteKit upstream is unreachable (deploys, restarts).
+ # Mounted into the nginx container at /var/www/html/maintenance.html.
+ location = /maintenance.html {
+ root /var/www/html;
+ internal;
+ add_header Cache-Control "no-store" always;
+ }
+
location /api/submit {
proxy_pass http://mail-api:8000/submit;
proxy_http_version 1.1;
@@ -36,6 +44,10 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
+
+ proxy_intercept_errors on;
+ proxy_connect_timeout 2s;
+ error_page 502 503 504 = /maintenance.html;
}
location / {
@@ -47,5 +59,13 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
+
+ # Serve a static maintenance page when the app container is down/restarting,
+ # rather than nginx's default 502/503. The `=` keeps the original status
+ # code so search engines treat it as a transient outage, not a real page.
+ proxy_intercept_errors on;
+ proxy_connect_timeout 2s;
+ proxy_next_upstream error timeout http_502 http_503 http_504;
+ error_page 502 503 504 = /maintenance.html;
}
}