caddy: improve error handling

only the best
This commit is contained in:
wo2w 2026-02-17 09:44:28 -05:00
parent 96c4304e08
commit f1fae7be7c

View file

@ -29,11 +29,9 @@
enableReload = false; enableReload = false;
extraConfig = '' extraConfig = ''
(cloudflare-tls) {
tls ${config.sops.secrets."caddy/wo2wz.fyi.crt".path} ${config.sops.secrets."caddy/wo2wz.fyi.key".path}
}
(default-settings) { (default-settings) {
import httpcat-errors
encode encode
header { header {
@ -45,6 +43,26 @@
-X-Powered-By -X-Powered-By
} }
} }
(cloudflare-tls) {
tls ${config.sops.secrets."caddy/wo2wz.fyi.crt".path} ${config.sops.secrets."caddy/wo2wz.fyi.key".path}
}
(httpcat-errors) {
handle_errors {
header Content-Type text/html
respond <<HTML
<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"><title>{err.status_code} {err.status_text}</title></head>
<body>
<img src="https://http.cat/{err.status_code}.jpg" alt="{err.status_code} {err.status_text}">
<p>shit</p><p>error id: {err.id}</p>
</body>
</html>
HTML
}
}
''; '';
# have to specify node tags here because if there are two tailscale blocks it just dont work # have to specify node tags here because if there are two tailscale blocks it just dont work
globalConfig = '' globalConfig = ''