Error pages that help instead of confusing people
Correct redirects and honest HTTP semantics for static sites.
This note documents a practical approach used in Steppe Infrastructure Notes. The goal is a setup that can be explained, reproduced, and checked from outside the machine.
Keep internal ports out of redirects
A backend listening on 8443 should not expose that port when redirecting a directory URL. Relative redirects avoid rewriting the public origin and work equally well behind a stream proxy or a reverse proxy.
absolute_redirect off;Return a real 404
A friendly page with a 200 status is soft-404 behaviour. Configure a styled error document but preserve the actual status code. Test missing files, missing directories, and malformed paths separately.
error_page 404 /404.html;
curl -I https://example.com/missingExercise directory navigation
Static generators often create /about/index.html. Verify both /about and /about/ to ensure the canonical redirect stays on the public host and does not produce a loop.
curl -I https://example.com/about
curl -I https://example.com/about/