Skip to content

Commit b8bc35f

Browse files
committed
Set loading screen only for 502 bad gateway and proxy all other 5xx errors
1 parent edee568 commit b8bc35f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

build/COPY_ROOT_0/opt/caddy/public/500.html renamed to build/COPY_ROOT_0/opt/caddy/public/502.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
</head>
3636
<body>
3737
<div class="spinner"></div>
38-
<div class="text">Waiting for the service to respond</div>
38+
<div class="text">Loading: Check container logs for progress</div>
3939

4040
<script>
4141
// Function to check if the current page is up
4242
function checkService() {
4343
fetch(window.location.href, { method: 'HEAD' })
4444
.then(response => {
45-
// If the response status is not a 5xx error
46-
if (response.status < 500 || response.status >= 600) {
45+
// Reload if the response status is not a 502 Bad Gateway error
46+
if (response.status != 502) {
4747
// Reload the page
4848
window.location.reload();
4949
}

build/COPY_ROOT_0/opt/caddy/share/base_config

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,16 @@
5353
@preauth {
5454
path /ai-dock/pre-auth
5555
}
56-
57-
handle_errors 5xx {
58-
rewrite * /500.html
59-
file_server
60-
}
61-
6256

6357
@default {
6458
path /*
6559
}
66-
60+
61+
handle_errors 502 {
62+
rewrite * /502.html
63+
file_server
64+
}
65+
6766
respond /ai-dock/health-check 200
6867
}
6968

0 commit comments

Comments
 (0)