caddy: reload instead of restart, validate before deploy, HTTP catch-all, header timeout, body limits; dns: drop stale records

- Caddyfile moves to config/ (directory mount) so 'caddy reload' sees the
  new file; the handler reloads gracefully instead of restarting
- template validate: runs 'caddy validate' with the image Caddy uses
- http:// catch-all aborts plain-HTTP requests for unknown hosts / bare IP;
  known hosts keep the automatic HTTPS redirect (tested)
- read_header timeout 10s (default 1 min)
- body_limit snippet: 1MB static sites, tinyauth, repaircafe; 10MB Pocket ID,
  Changedetection, ByteStash, Gotify, iGotify; 20MB Baikal
- dns: remove grist, habits, office, podcasts, pdftools (nothing serves them)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-27 13:13:16 -07:00
1 parent 1d21bd53cc
commit 9696c0e441
6 files changed
+70 -13

No files matched your search

+37 -3
View File
@@ -1,6 +1,14 @@
{% if caddy_custom %}
# Plugins come from the custom image (repo phil/caddy-custom).
{
servers {
timeouts {
# Clients get 10 s to send request headers (default 1 min), so
# slow-header connections can't pile up. Bodies (uploads) and
# responses are not limited.
read_header 10s
}
}
{% if caddy_custom %}
# Plugins come from the custom image (repo phil/caddy-custom).
order crowdsec first
order appsec after crowdsec
crowdsec {
@@ -13,9 +21,18 @@
# CrowdSec being down must not take every site down.
appsec_fail_open
}
{% endif %}
}
# Plain-HTTP requests for hostnames we don't serve, or for the bare IP:
# close the connection instead of redirecting. Known hosts still get
# Caddy's automatic HTTPS redirect (inserted before this catch-all), and
# ACME HTTP challenges are answered before routing. Unknown names over
# HTTPS already fail the TLS handshake (no certificate).
http:// {
abort
}
{% endif %}
# Tell browsers to always use HTTPS for each site for a year. No
# includeSubDomains, so hosts not served here are unaffected.
# defer: replace any HSTS header an app sends itself, so there's only one.
@@ -75,6 +92,7 @@
import hsts
import security_headers
import protect
import body_limit 1MB
header {
Content-Security-Policy "base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'"
X-Frame-Options SAMEORIGIN
@@ -125,6 +143,14 @@
{% endif %}
}
# Largest request body a site accepts: import body_limit <size>. Only for
# sites that never take big uploads; larger requests get 413.
(body_limit) {
request_body {
max_size {args[0]}
}
}
# Every proxied site: log, HSTS and the shared headers.
(site) {
import logging
@@ -136,6 +162,7 @@
{{ subdomains.pocketid }} {
import site
import no_framing
import body_limit 10MB
import ratelimit_login pocketid_login /api/webauthn/login/* /api/one-time-access-token* /api/one-time-access-email*
reverse_proxy pocket-id:1411
}
@@ -143,6 +170,7 @@
{{ subdomains.tinyauth }} {
import site
import no_framing
import body_limit 1MB
import ratelimit_login tinyauth_login /api/oauth/*
reverse_proxy tinyauth:3000
}
@@ -157,6 +185,7 @@ paper.thesatelliteoflove.com {
cal.thesatelliteoflove.com {
import site
import no_framing
import body_limit 20MB
redir /.well-known/caldav /dav.php 302
redir /.well-known/carddav /dav.php 302
# Web admin needs Pocket ID; CalDAV/CardDAV (/dav.php) stays as is.
@@ -189,6 +218,7 @@ loclog.thesatelliteoflove.com {
watcher.thesatelliteoflove.com {
import site
import no_framing
import body_limit 10MB
import ratelimit_login cd_login /login
# UI needs Pocket ID; the API (own key) stays reachable for scripts.
@ui not path /api/*
@@ -199,6 +229,7 @@ watcher.thesatelliteoflove.com {
snippets.thesatelliteoflove.com {
import site
import no_framing
import body_limit 10MB
import ratelimit_login bytestash_login /api/auth/login /api/auth/register
reverse_proxy bytestash:5000
}
@@ -255,6 +286,7 @@ models.thesatelliteoflove.com {
gotify.thesatelliteoflove.com {
import site
import no_framing
import body_limit 10MB
import ratelimit_login gotify_login /client /user
reverse_proxy gotify:80
}
@@ -262,6 +294,7 @@ gotify.thesatelliteoflove.com {
gotify-assistant.thesatelliteoflove.com {
import site
import no_framing
import body_limit 10MB
reverse_proxy igotify-assistant:8080
}
@@ -320,6 +353,7 @@ listmonk.nerder.land {
repaircafe.nerder.land {
import site
import body_limit 1MB
redir /volunteer-signup https://listmonk.nerder.land/subscription/form 301
}