Skip to content

Commit 98a61ff

Browse files
committed
fix(@angular-devkit/build-angular): in vite skip SSR middleware for path with extensions
Do not try to SSR a request that has extensions. Closes #26199
1 parent 1aaed5e commit 98a61ff

File tree

1 file changed

+7
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+7
-1
lines changed

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,13 @@ export async function setupServer(
581581
next: Connect.NextFunction,
582582
) {
583583
const url = req.originalUrl;
584-
if (!url || url.endsWith('.html')) {
584+
if (
585+
// Skip if path is not defined.
586+
!url ||
587+
// Skip if path is like a file.
588+
// NOTE: We use a regexp to mitigate against matching requests like: /browse/pl.0ef59752c0cd457dbf1391f08cbd936f
589+
/^\.[a-z]{2,4}$/i.test(path.extname(url.split('?')[0]))
590+
) {
585591
next();
586592

587593
return;

0 commit comments

Comments
 (0)