From 87c80d3b2fd04e5a0a68c4f8c3e07abdf8ffe1c4 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Tue, 3 Nov 2026 16:05:44 +0100 Subject: [PATCH] docs(v3): fallback page keeps 404 for missing assets --- src/v3/configuration/cli.md | 2 +- src/v3/features/error-pages.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/v3/configuration/cli.md b/src/v3/configuration/cli.md index 5a17602..4c66f58 100644 --- a/src/v3/configuration/cli.md +++ b/src/v3/configuration/cli.md @@ -41,7 +41,7 @@ Options: --page404 HTML file path for 404 errors. If the path is not specified or simply doesn't exist then the server will use a generic HTML error message. If a relative path is used then it will be resolved under the root directory [env: SERVER_ERROR_PAGE_404=] [default: ./404.html] --page-fallback - A HTML file path (not relative to the root) used for GET requests when the requested path doesn't exist. The fallback page is served with a 200 status code, useful when using client routers. If the path doesn't exist then the feature is not activated [env: SERVER_FALLBACK_PAGE=] [default: ""] + A HTML file path (not relative to the root) used for GET requests when the requested path doesn't exist. The fallback page is served with a 200 status code, useful when using client routers. Requests for missing assets keep their 404: those whose `Sec-Fetch-Dest` is not a document or frame or, without that header, a non-HTML extension (like `/favicon.ico`) not asking for `text/html`. If the path doesn't exist then the feature is not activated [env: SERVER_FALLBACK_PAGE=] [default: ""] -g, --log-level Specify a logging level in lower case. Values: error, warn, info, debug or trace [env: SERVER_LOG_LEVEL=] [default: error] --log-format diff --git a/src/v3/features/error-pages.md b/src/v3/features/error-pages.md index bb4c929..54fa704 100644 --- a/src/v3/features/error-pages.md +++ b/src/v3/features/error-pages.md @@ -44,3 +44,12 @@ static-web-server \ --root ./public \ --page-fallback ./public/index.html ``` + +### Missing assets keep their 404 + +The fallback page replaces a `404` only for page navigations, so missing assets like `/favicon.ico` or `/assets/app.js` still respond `404`. A request counts as an asset when: + +- its `Sec-Fetch-Dest` header is present and is not `document`, `iframe` or `frame`, or +- without that header, its path has a known non-HTML file extension and its `Accept` header does not list `text/html` or `application/xhtml+xml` (a `*/*` wildcard does not count). + +Browsers are unaffected, since navigations send `Sec-Fetch-Dest: document` or `Accept: text/html`. Other clients requesting a client route with a dotted last segment, like `/search/example.com` with `Accept: */*`, get a `404`.