Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/v3/configuration/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Options:
--page404 <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 <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 <LOG_LEVEL>
Specify a logging level in lower case. Values: error, warn, info, debug or trace [env: SERVER_LOG_LEVEL=] [default: error]
--log-format <LOG_FORMAT>
Expand Down
9 changes: 9 additions & 0 deletions src/v3/features/error-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.