Skip to content

Commit eadadb8

Browse files
committed
fix(@angular/ssr): skip SSR processing for well-known non-Angular URLs like favicon.ico
Skip processing of well known non Angular files. Closes: #32125 (cherry picked from commit 2d56a31)
1 parent b671245 commit eadadb8

File tree

1 file changed

+15
-0
lines changed
  • packages/angular/ssr/src

1 file changed

+15
-0
lines changed

packages/angular/ssr/src/app.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ import { AngularBootstrap, renderAngular } from './utils/ng';
2727
import { promiseWithAbort } from './utils/promise';
2828
import { buildPathWithParams, joinUrlParts, stripLeadingSlash } from './utils/url';
2929

30+
/**
31+
* A set of well-known URLs that are not handled by Angular.
32+
*
33+
* These URLs are typically for static assets or endpoints that should
34+
* bypass the Angular routing and rendering process.
35+
*/
36+
const WELL_KNOWN_NON_ANGULAR_URLS: ReadonlySet<string> = new Set<string>([
37+
'favicon.ico',
38+
'.well-known/appspecific/com.chrome.devtools.json',
39+
]);
40+
3041
/**
3142
* Maximum number of critical CSS entries the cache can store.
3243
* This value determines the capacity of the LRU (Least Recently Used) cache, which stores critical CSS for pages.
@@ -166,6 +177,10 @@ export class AngularServerApp {
166177
*/
167178
async handle(request: Request, requestContext?: unknown): Promise<Response | null> {
168179
const url = new URL(request.url);
180+
if (WELL_KNOWN_NON_ANGULAR_URLS.has(url.pathname)) {
181+
return null;
182+
}
183+
169184
this.router ??= await ServerRouter.from(this.manifest, url);
170185
const matchedRoute = this.router.match(url);
171186

0 commit comments

Comments
 (0)