Engineering notebook · 2026-10-16 · 5 minute read

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 Kin4 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/missing

Exercise 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/
Verification habit: keep the commands from this note with the change and run them again after the next reboot or service upgrade.

← All field notes