caddy: improve error handling
only the best
This commit is contained in:
parent
96c4304e08
commit
f1fae7be7c
1 changed files with 22 additions and 4 deletions
|
|
@ -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 = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue