Have you used AI?
No
Bug Description
In v8 of webpack-dev-middleware, the middleware is trying to serve req.originalUrl when it should be trying to serve req.url. This is happening because of this logic. This breaks usage when used with URL rewrites, which is common with middleware like connect-history-api-fallback.
Link to Minimal Reproduction and step to reproduce
https://github.com/Methuselah96/webpack-dev-middleware-rewrite
Steps:
- Run
npm install
- Run
npm run watch
- Navigate to http://localhost:3000/some-path
- Observe "Cannot GET /some-path" error
Expected Behavior
The dev middleware should respect the req.url and serve /index.html instead of returning an error
Actual Behavior
The dev middleware tries to load /some-path and fails
Environment
System:
OS: Windows 11 10.0.26200
CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13500
Memory: 7.01 GB / 31.65 GB
Binaries:
Node: 24.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 4.9.2 - C:\Program Files\nodejs\yarn.CMD
npm: 11.6.1 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.15.9 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Chrome: 146.0.7680.165
Edge: Chromium (140.0.3485.54)
Firefox: 149.0 - C:\Program Files\Mozilla Firefox\firefox.exe
Internet Explorer: 11.0.26100.8115
Packages:
html-webpack-plugin: ^5.6.6 => 5.6.6
webpack: ^5.105.4 => 5.105.4
webpack-cli: ^7.0.2 => 7.0.2
webpack-dev-middleware: ^8.0.2 => 8.0.2
Is this a regression?
Yes (please specify version below)
Last Working Version
v7.4.5
Additional Context
No response
Have you used AI?
No
Bug Description
In v8 of webpack-dev-middleware, the middleware is trying to serve
req.originalUrlwhen it should be trying to servereq.url. This is happening because of this logic. This breaks usage when used with URL rewrites, which is common with middleware like connect-history-api-fallback.Link to Minimal Reproduction and step to reproduce
https://github.com/Methuselah96/webpack-dev-middleware-rewrite
Steps:
npm installnpm run watchExpected Behavior
The dev middleware should respect the
req.urland serve/index.htmlinstead of returning an errorActual Behavior
The dev middleware tries to load
/some-pathand failsEnvironment
System: OS: Windows 11 10.0.26200 CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13500 Memory: 7.01 GB / 31.65 GB Binaries: Node: 24.11.0 - C:\Program Files\nodejs\node.EXE Yarn: 4.9.2 - C:\Program Files\nodejs\yarn.CMD npm: 11.6.1 - C:\Program Files\nodejs\npm.CMD pnpm: 9.15.9 - C:\Program Files\nodejs\pnpm.CMD Browsers: Chrome: 146.0.7680.165 Edge: Chromium (140.0.3485.54) Firefox: 149.0 - C:\Program Files\Mozilla Firefox\firefox.exe Internet Explorer: 11.0.26100.8115 Packages: html-webpack-plugin: ^5.6.6 => 5.6.6 webpack: ^5.105.4 => 5.105.4 webpack-cli: ^7.0.2 => 7.0.2 webpack-dev-middleware: ^8.0.2 => 8.0.2Is this a regression?
Yes (please specify version below)
Last Working Version
v7.4.5
Additional Context
No response