From 230fb50d3a895a084c50c373165e2672a547bcf1 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Wed, 11 Dec 2024 09:09:31 +0100 Subject: [PATCH] improve errors --- proxy/caddy/Caddyfile | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/proxy/caddy/Caddyfile b/proxy/caddy/Caddyfile index 4cc073c..0e25496 100644 --- a/proxy/caddy/Caddyfile +++ b/proxy/caddy/Caddyfile @@ -6,15 +6,6 @@ } } -(error) { - root * /usr/share/caddy - rewrite * /error.html - templates - file_server { - status {err.status_code} - } -} - *.{$DOMAIN} { tls { dns netcup { @@ -86,25 +77,18 @@ reverse_proxy nginx-mailcow:8090 } - # Fallback for otherwise unhandled domains + # Fallback unhandled (sub)domains handle { - respond "404 Not Found" 404 + error 404 } - # handle wrong url pathes - handle_errors 404 { - #respond "{err.status_code} {err.status_text}" {err.status_code} - import error - } - - # handle errors of proxy backends are down - # handle_errors 502 { - # respond "503 Service Unavailable" 503 - # } - - # every other error handle_errors { - import error + root * /usr/share/caddy + rewrite * /error.html + templates + file_server { + status {err.status_code} + } } }