From a5ba9023323d2884cf1cffbe7cb434a91aaefce1 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 15 Dec 2025 13:17:08 +0000 Subject: [PATCH] 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 --- packages/angular/ssr/src/app.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/angular/ssr/src/app.ts b/packages/angular/ssr/src/app.ts index ee14f8a26105..83b18a25ef72 100644 --- a/packages/angular/ssr/src/app.ts +++ b/packages/angular/ssr/src/app.ts @@ -27,6 +27,17 @@ import { AngularBootstrap, renderAngular } from './utils/ng'; import { promiseWithAbort } from './utils/promise'; import { buildPathWithParams, joinUrlParts, stripLeadingSlash } from './utils/url'; +/** + * A set of well-known URLs that are not handled by Angular. + * + * These URLs are typically for static assets or endpoints that should + * bypass the Angular routing and rendering process. + */ +const WELL_KNOWN_NON_ANGULAR_URLS: ReadonlySet = new Set([ + 'favicon.ico', + '.well-known/appspecific/com.chrome.devtools.json', +]); + /** * Maximum number of critical CSS entries the cache can store. * 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 { */ async handle(request: Request, requestContext?: unknown): Promise { const url = new URL(request.url); + if (WELL_KNOWN_NON_ANGULAR_URLS.has(url.pathname)) { + return null; + } + this.router ??= await ServerRouter.from(this.manifest, url); const matchedRoute = this.router.match(url);