docs-site: serve the branded 404 page with a real 404 status
Some checks failed
CI / Lint and Format (push) Has been cancelled
CI / Test Python 3.11 on macos-latest (push) Has been cancelled
CI / Test Python 3.12 on macos-latest (push) Has been cancelled
CI / Test Python 3.13 on macos-latest (push) Has been cancelled
CI / Test Python 3.10 on ubuntu-latest (push) Has been cancelled
CI / Test Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Test Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Test Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Build Package (push) Has been cancelled

Missing paths returned 404 with an EMPTY body — the built 404.html was
never reached. handle_errors routes 404s to it, status stays honest.
This commit is contained in:
Ryan Malloy 2026-08-11 23:39:40 +00:00
parent 1cb6ad1a59
commit eb6cf63b42

View File

@ -8,4 +8,14 @@
@hashed path /_astro/*
header @hashed Cache-Control "public, max-age=31536000, immutable"
# Serve the branded 404 page with a real 404 status. It was already in
# the build, just never reached Caddy returned an empty error body.
handle_errors {
@404 expression {err.status_code} == 404
handle @404 {
rewrite * /404.html
file_server
}
}
}