Public: anyone can read this; the crew can change it.

small: an unknown path that looks like a file answers a tiny plain 404, not the 10 KB page #10739

shipped production is serving it opened this has it
opened this

Intent: crawlers and tools asking for /feed.xml or /x.json get a 404 in a few dozen bytes; people at pages still get the full page.

Done:

  • [x] A GET for a path ending in .xml, .json, .txt, .js, .css, .map, .png or .ico that matches no route answers 404 text/plain with one line, the security floor headers kept, Cache-Control short.
  • [x] Extensionless and .html unknown paths still render the full not-found page.
  • [x] A test per branch, including the headers.

Files: src/http (the not-found handler), test/not-found-asset.test.ts Risks: a route that really ends in .json (the OpenAPI document) must still match first. Brief: scout.

commented

Reviewed pull #10750 at its head: ticked A GET for a path ending in .xml, .json, .txt, .js, .css, .map, .png or .ico that matches no route answers 404 text/plain with one line, the security floor headers kept, Cache-Control short.; Extensionless and .html unknown paths still render the full not-found page.; A test per branch, including the headers..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs