404/redirect handling for unknown routes and subdomains #26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Unknown routes on the frontend show a blank page or raw error. Unknown subdomains show Caddy's default error page.
What to do
Files to change
apps/web/src/routes/__root.tsx— TanStack Router supports anotFoundComponent. Add a styled 404 page.Caddyfile(on VPS at~/lila-app/) — add a catch-all block for unrecognized subdomains.apps/api/src/app.ts— optionally add a catch-all route that returns JSON 404 instead of Express's defaultCannot GET /path.Acceptance criteria
lilastudy.com/nonexistentshows a styled 404 page with link back to homerandom.lilastudy.comeither redirects tolilastudy.comor shows a 404api.lilastudy.com/nonexistentreturns{ "error": "Not Found" }with status 404Notes
TanStack Router docs on not found: https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors
The Caddyfile currently only defines blocks for
lilastudy.com,api.lilastudy.com, andgit.lilastudy.com. Wildcard DNS means any subdomain resolves to the VPS.