-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Reproduction
https://stackblitz.com/edit/github-mdayxhkg?file=app%2Froot.tsx
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@react-router/dev: ^7.7.1 => 7.8.0
@react-router/node: ^7.7.1 => 7.8.0
@react-router/serve: ^7.7.1 => 7.8.0
react-router: ^7.7.1 => 7.8.0
vite: ^6.3.3 => 6.3.5Used Package Manager
npm
Expected Behavior
All requests, including /__manifest and 404 (no match), should run through root middleware so common logic (logging, response headers, cleanup, etc.) executes consistently.
Actual Behavior
Neither /__manifest nor 404 (no match) requests run through middleware.
I'm working around the latter by explicitly defining a 404 route:
// routes/$/route.tsx
import { data } from "react-router";
export const loader = async () => {
throw data(null, { status: 404 });
};
// Opt-out of resource route behaviour
export default () => null;For the same reasons discussed in #13766 (comment), it's important all requests going in and out of the server go through middleware.