Skip to content

Commit 580c8f0

Browse files
committed
Note the SPA fallback in the file-router 404 path
1 parent 146adca commit 580c8f0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎content/(dynamic)/functions.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The OpenNext build wins over a stray `handler.ts`, because framework output is t
2929

3030
Files in the tree are served before the worker runs. Only a path with no matching file reaches the route table.
3131

32-
A root handler claims the whole site, so it receives every path that is not a file, and its response is final. A `404.html` in the tree is never used for those paths: visitors see whatever the handler returns. To show a 404 page, return HTML from the handler's fallback for browser requests, or use a `functions/` directory. With a file router, a path that no route claims gets the static 404: the nearest `404.html`, then the Spacefast page.
32+
A root handler claims the whole site, so it receives every path that is not a file, and its response is final. A `404.html` in the tree is never used for those paths: visitors see whatever the handler returns. To show a 404 page, return HTML from the handler's fallback for browser requests, or use a `functions/` directory. With a file router, a path that no route claims falls through to static handling: the SPA `fallback` if you set one, otherwise the nearest `404.html`, then the Spacefast page. See [The 404 page](/routing#the-404-page).
3333

3434
### The `functions/` file router
3535

@@ -57,7 +57,7 @@ A module's filename is its route and the HTTP methods it exports are the methods
5757

5858
Route modules can be `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, or `.cjs`. A name starting with `_` or `.` is a colocated helper and is never routed, and neither are `.d.ts` files or anything matching `*.test.*` / `*.spec.*`. A catch-all is terminal or nothing: `[...rest]` in the middle of a path is skipped.
5959

60-
A path that exists at other methods answers 405 with an `Allow` header. A path in no file's table is a plain 404 and the worker never wakes.
60+
A path that exists at other methods answers 405 with an `Allow` header. A path in no file's table never wakes the worker and falls through to static handling, as described above.
6161

6262
## The handler
6363

0 commit comments

Comments
 (0)