site address:
github.com/angular/angular-cli/pull/34091/files redirected to: github.com/angular/angular-cli/pull/34091/files
site title:
fix(@angular/ssr): resolve the request path through the router's URL grammar before matching by glivter · Pull Request #34091 · angular/angular-cli · GitHub
|
|
|
Our opinion (on Thursday 19 November 2026 7:43:13 UTC):
- no comments
|
|
|
|
After content analysis of this website we propose the following hashtags:
|
|
|
|
Meta tags:
description= PR Checklist
The commit message follows our guidelines
Tests for the changes have been added (for bug fixes / features)
Docs have been added / updated (for bug fixes / features)
PR Type
Bugfix
What is the current behavior?
Issue Number: #33555
ServerRouter.match tokenises the pathname by splitting on /, while @angular/router parses it with DefaultUrlSerializer, a grammar in which (, ), ; and // are metacharacters and unparseable input is silently discarded. The two disagree on which route a request is.
Verified against the published @angular/router 22.1.6, serialize(parse(x)):
input
router resolves to
/page)
/page
/page(
/page
/page;
/page
/(page)
/page
/a/1//b
/a/1
Because ServerRouter.match selects the response s headers, status, renderMode and preload while @angular/router selects the component that renders into the body, appending one character to a path produces a response whose body comes from one route and whose per-route configuration comes from another. A route configured with Cache-Control: no-store, private and X-Frame-Options: DENY is served under the catch-all s policy with neither header, and a route declared RenderMode.Client is server-rendered.
The @angular/router side is intentional. (name:seg) is the documented secondary-outlet syntax, ;k=v the documented matrix-parameter syntax, and angular/angular#64507 deliberately made an unnamed (...) group mean the primary outlet.
What is the new behavior?
ServerRouter.match resolves the pathname through the router s own serializer before tokenising it, so both matchers agree on which route a request is.
This is the same divergence that 85c18b4 fixed for matrix parameters, where it surfaced as URLs failing to match their route. stripMatrixParams handled that case; parentheses and interior // are the remaining ones. Going through the serializer covers the class rather than the next symptom, and @angular/router is already a peer dependency of this package.
Normalisation runs before stripMatrixParams, because the serializer preserves matrix parameters, so they are still stripped exactly as today. A path the serializer cannot parse is returned unchanged, so malformed percent-encoding keeps its existing behaviour.
Known residual, stated up front: an application that supplies a custom UrlSerializer still diverges, because this normalises with DefaultUrlSerializer. The durable fix is to build and query the route tree through the serializer the application injects, which is a larger change. I am happy to take this in that direction instead, or to have this closed in favour of an internal patch if one is already in progress; the issue matters more than the PR.
Tests
packages/angular/ssr/test/utils/url_spec.ts covers normalizeUrlPath directly: the divergent spellings, an unchanged ordinary path, preserved encoding including %2F, preserved matrix parameters, and an unparseable path returned as-is. Every expected value was measured against @angular/router 22.1.6 rather than assumed.
packages/angular/ssr/test/routes/router_spec.ts covers the end-to-end selection: /home), /home(, /home; and /(home) select the same route metadata as /home, /user/123//x selects /user/*, and an unknown route still matches nothing.
Both were confirmed to FAIL against main before the change, with the failure reproducing the real defect:
/home): Expected undefined to equal Object( route: /home , renderMode: 0 ).
//packages/angular/ssr/test:test is green with the change, 257 specs.
Does this PR introduce a breaking change?
Yes
No
Every path that does not use the router s metacharacters tokenises exactly as before. The behaviour change is limited to paths where the two matchers currently disagree, and there the server now agrees with what is actually rendered.
Other information
Originally filed as #34090, which turned out to be a duplicate of #33555 and has been closed in its favour; the additional coverage from it is now a comment on #33555. My prior-art sweep missed #33555 because I searched my own vocabulary, route-tree tokenisation and matcher divergence , rather than the words a reporter would use. Credit to @SkyZeroZx for catching it.
Also reported via the Google OSS VRP as 559764571, which the Bug Hunter Team triaged and invited me to disclose publicly.
This change and its testing were produced with AI assistance. The equivalence table and every value asserted in the new tests were executed against the published @angular/router 22.1.6 rather than reasoned about, and the tests were confirmed to fail before the fix.;
Headings (most frequently used words):
uh, oh, the, navigation, for, fix, angular, ssr, resolve, request, path, through, router, url, grammar, before, matching, 34091, are, footer, you, sep, 14, 2026, choose, reason, hiding, this, comment, diff, view, menu, repository, there, no, files, selected, viewing, sure, want, to, change, base, filter, by, extension, gemini, code, assist, bot, glivter,
Text of the page (most frequently used words):
the (88), path (33), file (32), and (32), pathname (31), this (30), page (30), normalizeurlpath (30), angular (29), #router (27), expect (24), url (22), tobe (21), that (18), for (18), github (16), from (16), route (16), characters (16), line (15), ssr (15), expand (13), loading (12), show (12), hidden (12), unicode (12), serializer (12), applied (11), reload (11), return (11), open (11), while (10), request (10), all (10), should (10), diff (10), with (10), comment (10), you (9), cannot (9), change (9), there (9), fast (9), utils (9), packages (9), const (9), string (9), can (8), not (8), check (8), code (8), changes (8), was (8), 2fb (8), stripmatrixparams (8), defaulturlserializer (8), resolve (8), number (8), bidirectional (8), learn (8), home (8), serialized (8), includes (8), suggestion (7), please (7), suggestions (7), comments (7), only (7), reason (7), user (7), import (7), more (7), match (7), are (7), grammar (7), will (7), routes (7), sign (7), one (6), error (6), same (6), its (6), parse (6), what (6), down (6), may (6), review (6), about (6), view (6), test (6), new (6), http (6), server (6), queryorfragment (6), through (6), security (5), commit (5), function (5), which (5), index (5), html (5), encoding (5), unchanged (5), describe (5), than (5), rendermode (5), matching (5), hide (5), quality (5), choose (5), glivter (5), url_serializer (5), returns (5), src (5), fix (5), base (5), your (5), 2026 (4), pull (4), outdated (4), add (4), single (4), parser (4), split (4), these (4), would (4), skip (4), them (4), 123 (4), stripindexhtmlfromurl (4), original (4), contains (4), text (4), interpreted (4), compiled (4), differently (4), appears (4), below (4), editor (4), reveals (4), desktop (4), delete (4), edit (4), additions (4), deletions (4), localhost (4), metacharacters (4), rewrites (4), measured (4), hiding (4), copy (4), serialize (4), export (4), tree (4), before (4), files (4), load (4), commits (4), support (4), copilot (4), community (3), status (3), navigation (3), has (3), resolved (3), existing (3), batch (3), because (3), something (3), went (3), wrong (3), retry (3), cheap (3), real (3), exists (3), allowlist (3), out (3), still (3), against (3), resolves (3), url_spec (3), client (3), into (3), agree (3), render (3), router_spec (3), character (3), segment (3), over (3), 583 (3), probes (3), disagrees (3), every (3), across (3), sep (3), search (3), example (3), selected (3), whitespace (3), filter (3), 34091 (3), branch (3), refname (3), account (3), another (3), tab (3), window (3), refresh (3), session (3), developers (3), changelog (3), customer (3), enterprise (3), grade (3), features (3), build (3), contact (2), privacy (2), terms (2), footer (2), merge (2), must (2), lines (2), viewing (2), toggle (2), 2bb (2), 20b (2), predicate (2), close (2), leaves (2), normalize (2), paths (2), malformed (2), percent (2), keeps (2), behaviour (2), preserve (2), 20url (2), encoded (2), slash (2), each (2), treats (2), unknown (2), toequal (2), renders (2), taken (2), select (2), 128 (2), serverrouter (2), reactions (2), sorry (2), denylist (2), here (2), front (2), inputs (2), never (2), empty (2), slow (2), set (2), other (2), printable (2), ascii (2), range (2), first (2), enough (2), low (2), duplicate (2), off (2), topic (2), abuse (2), spam (2), displayed (2), others (2), problem (2), markdown (2), link (2), catch (2), slice (2), reproduces (2), query (2), fragment (2), matched (2), try (2), requests (2), present (2), non_normalizing_path (2), returned (2), own (2), such (2), found (2), license (2), routetree (2), www (2), com (2), apply (2), unified (2), failed (2), jump (2), extension (2), old (2), default (2), could (2), tags (2), branches (2), main (2), issue (2), insights (2), actions (2), 197 (2), repository (2), cli (2), signed (2), universe (2), training (2), integrations (2), stories (2), center (2), documentation (2), business (2), fixes (2), products (2), secret (2), perform, action, time, share, personal, information, manage, cookies, docs, inc, right, now, back, later, queued, multi, pending, reviews, been, marked, order, create, valid, applying, deleted, supported, per, subset, closed, invalid, were, made, annotations, notes, oops, versus, unnormalized, bails, metacharacter, alter, dot, segments, handling, matrix, parameters, owns, including, leave, ordinary, verified, published, left, hand, value, spellings, 220, 221, stripleadingslash, joinurlparts, buildpathwithparams, addtrailingslash, bob, 20roberts, encodedusermetadata, handle, params, nope, tobeundefined, invent, config, too, interior, ends, withcontext, different, body, response, headers, constructs, decoded, components, pushed, tests, pinning, normalised, 018fcbe, shape, bug, fixing, standing, disagreeing, nobody, thought, enumerate, plus, anything, unrecognised, takes, full, space, bailing, skips, normalisation, input, suggested, conservative, author, avoid, performance, overhead, parsing, serializing, incoming, common, hot, since, vast, majority, standard, without, any, like, immediately, none, avoids, invoking, relatively, expensive, unnecessarily, bot, gemini, assist, 290, 275, thread, param, makes, both, sides, distinct, passing, two, therefore, disagree, parses, tokenises, splitting, spelling, take, becomes, among, rewrite, unapplied, deliberately, matter, today, entirely, built, lifetime, module, reusable, stateless, instance, replace, matrix_params_regex, 227, 229, removes, trailing, https, dev, tokenising, let, corresponding, strip, class, routetreenodemetadata, extractroutesandcreateroutetree, angularappmanifest, manifest, conversations, clear, filters, viewed, type, nbsp, 6d6decb, changed, checks, conversation, wants, matcher, divergence, some, removed, timeline, become, sure, want, nothing, already, clicking, our, occasionally, send, related, emails, statement, service, free, maintainers, have, question, project, items, issues, message, dismiss, alert, switched, accounts, appearance, settings, pricing, event, talks, workshops, next, partners, company, forum, events, webinars, blog, resource, connect, resources, premium, advanced, ons, trust, why, evaluate, see, industries, government, manufacturing, financial, services, healthcare, industry, nonprofits, startups, team, enterprises, stage, businesses, source, latest, improvements, place, developer, articles, sponsors, trending, repos, explore, customize, certifications, scanning, leak, prevention, protection, vulnerability, detection, remediation, secure, cloud, development, environments, codespaces, analysis, enforcement, automation, ship, coding, agent, tasks, projects, automated, work, hosting, collaboration, platform, menu, content,
Text of the page (random words):
efore matching by glivter pull request 34091 angular angular cli github skip to content navigation menu sign in products platform github repository hosting code review and collaboration copilot ai coding agent for tasks projects and automated work build ship actions ci cd and automation code quality quality analysis fixes and enforcement codespaces cloud development environments secure code security vulnerability detection and remediation secret protection secret scanning and leak prevention all features developers learn documentation training certifications build build with copilot customize copilot integrations explore trending repos github sponsors developer articles changelog changelog your source for the latest features improvements and fixes across github products all in one place businesses by stage enterprises team startups nonprofits by industry healthcare financial services manufacturing government see all industries evaluate github why github customer stories business insights trust center add ons github advanced security enterprise grade code security copilot for business enterprise grade ai features premium support enterprise grade 24 7 support resources learn connect documentation resource center blog events webinars community forum customer stories integrations support customer support training github status company about partners changelog github universe github universe the event for developers by developers talks workshops and what s next for github pricing search sign in sign up appearance settings you signed in with another tab or window reload to refresh your session you signed out in another tab or window reload to refresh your session you switched accounts on another tab or window reload to refresh your session dismiss alert message angular angular cli repository navigation code issues 197 197 pull requests 24 24 actions security and quality 8 8 insights more items fix angular ssr resolve the request path through the router s url grammar before matching 34091 new issue have a question about this project sign up for a free github account to open an issue and contact its maintainers and the community sign up for github by clicking sign up for github you agree to our terms of service and privacy statement we ll occasionally send you account related emails already on github sign in to your account open glivter wants to merge 1 commit into angular main base main choose a base branch branches tags could not load branches branch not found refname loading refname default could not load tags nothing to show refname default loading are you sure you want to change the base some commits from the old base branch may be removed from the timeline and old review comments may become outdated loading change base from glivter fix ssr route matcher divergence conversation 4 commits 1 checks 39 files changed uh oh there was an error while loading please reload this page open fix angular ssr resolve the request path through the router s url grammar before matching 34091 show file tree hide file tree changes from all commits commits show all changes 1 commit select commit 6d6decb fix angular ssr resolve the request path through the router s url glivter sep 14 2026 file filter filter by extension filter by extension ts nbsp 4 all 1 file type selected viewed files clear filters conversations failed to load comments retry loading uh oh there was an error while loading please reload this page jump to jump to file failed to load files retry loading uh oh there was an error while loading please reload this page diff view unified split hide whitespace apply and reload show whitespace diff view unified split hide whitespace apply and reload packages angular ssr src routes packages angular ssr src routes router ts router ts utils packages angular ssr src utils url ts url ts test routes packages angular ssr test routes router_spec ts router_spec ts utils packages angular ssr test utils url_spec ts url_spec ts there are no files selected for viewing 6 changes 4 additions 2 deletions 6 packages angular ssr src routes router ts show comments view file edit file delete file open in desktop this file contains hidden or bidirectional unicode text that may be interpreted or compiled differently than what appears below to review open the file in an editor that reveals hidden unicode characters learn more about bidirectional unicode characters show hidden characters original file line number diff line number diff line change expand up 7 7 7 7 import angularappmanifest from manifest import stripindexhtmlfromurl stripmatrixparams from utils url import normalizeurlpath stripindexhtmlfromurl stripmatrixparams from utils url import extractroutesandcreateroutetree from ng routes import routetree routetreenodemetadata from route tree expand down expand up 86 7 86 9 export class serverrouter strip index html from url if present a request to http www example com page index html will render the angular route corresponding to http www example com page let pathname stripindexhtmlfromurl url pathname stripmatrixparams pathname resolve the path through the router s own grammar before tokenising it so the route selected here is the route angular router will render pathname stripmatrixparams normalizeurlpath pathname return this routetree match pathname expand down 62 changes 62 additions 0 deletions 62 packages angular ssr src utils url ts show comments view file edit file delete file open in desktop this file contains hidden or bidirectional unicode text that may be interpreted or compiled differently than what appears below to review open the file in an editor that reveals hidden unicode characters learn more about bidirectional unicode characters show hidden characters original file line number diff line number diff line change expand up 6 6 6 8 found in the license file at https angular dev license import defaulturlserializer from angular router removes the trailing slash from a url if it exists expand down expand up 227 6 229 66 export function stripmatrixparams pathname string string return pathname includes pathname replace matrix_params_regex pathname a single reusable serializer defaulturlserializer is stateless so one instance is enough for the lifetime of the module const url_serializer new defaulturlserializer characters defaulturlserializer never rewrites measured across the printable ascii range against angular router 22 1 6 a path built only from these with no empty segment is returned unchanged so it can skip the parse entirely deliberately an allowlist a denylist of the metacharacters that matter today leaves every other rewrite unapplied measured over 583 probes such a check disagrees with the serializer on 87 of them a b and 41 among them an unknown character has to take the slow path or the fast path becomes the same cheap predicate in front of a real parser split this function exists to close const non_normalizing_path a za z0 9 _ rewrites a url path into the spelling angular router will resolve it to server route matching tokenises the path by splitting on while the client router parses it with defaulturlserializer a grammar in which and are metacharacters the two therefore disagree on inputs such as page which the router resolves to page and the server route tree treats as a distinct segment passing the path through the router s own grammar first makes both sides agree on which route a request is a path the serializer cannot parse is returned unchanged so malformed percent encoding keeps its existing behaviour param pathname the url path to normalize returns the path as angular router would resolve it example ts normalizeurlpath page returns page normalizeurlpath page returns page normalizeurlpath a 1 b returns a 1 normalizeurlpath page returns page export function normalizeurlpath pathname string string fast path the serializer would return this path unchanged so skip the parse if pathname includes non_normalizing_path test pathname return pathname try const serialized url_serializer serialize url_serializer parse pathname serialize reproduces the query string and fragment only the path is matched const queryorfragment serialized search return queryorfragment 1 serialized serialized slice 0 queryorfragment catch return pathname comment thread comment on lines 275 to 290 gemini code assist bot sep 14 2026 copy link copy markdown there was a problem hiding this comment choose a reason for hiding this comment the reason will be displayed to describe this comment to others learn more choose a reason spam abuse off topic outdated duplicate resolved low quality hide comment to avoid the performance overhead of parsing and serializing every single incoming request url path which is a common hot path in ssr we can add a fast path check since the vast majority of requests will be standard paths without any router metacharacters like or we can return the pathname immediately if none of these characters are present this avoids invoking the relatively expensive defaulturlserializer parser and serializer unnecessarily export function normalizeurlpath pathname string string if pathname includes pathname includes pathname includes pathname includes pathname includes pathname includes return pathname try const serialized url_serializer serialize url_serializer parse pathname serialize reproduces the query string and fragment only the path is matched const queryorfragment serialized search return queryorfragment 1 serialized serialized slice 0 queryorfragment catch return pathname sorry something went wrong uh oh there was an error while loading please reload this page all reactions glivter sep 14 2026 copy link copy markdown author there was a problem hiding this comment choose a reason for hiding this comment the reason will be displayed to describe this comment to others learn more choose a reason spam abuse off topic outdated duplicate resolved low quality hide comment taken with one change to the character set because i measured the suggested one first and it is not conservative enough bailing out only on and skips normalisation for every other input defaulturlserializer rewrites over 583 probes across the printable ascii range against angular router 22 1 6 that check disagrees with the serializer on 87 of them a b fast path a b serializer a 20b a b fast path a b serializer a 2bb 41 fast path 41 serializer a a 2fb fast path a 2fb serializer a 2fb the full set of characters that can change a path is space and a denylist here would be the same shape as the bug this pr is fixing a cheap character check standing in front of a real parser and disagreeing with it on the inputs nobody thought to enumerate so the fast path is an allowlist of the characters the serializer never rewrites plus a check for an empty segment and anything unrecognised takes the slow path measured over the same 583 probes it disagrees with the serializer on 0 pushed in 018fcbe with tests pinning that a b a b 41 and a 2fb are still normalised sorry something went wrong uh oh there was an error while loading please reload this page all reactions constructs a decoded url string from its components expand down 28 changes 28 additions 0 deletions 28 packages angular ssr test routes router_spec ts show comments view file edit file delete file open in desktop this file contains hidden or bidirectional unicode text that may be interpreted or compiled differently than what appears below to review open the file in an editor that reveals hidden unicode characters learn more about bidirectional unicode characters show hidden characters original file line number diff line number diff line change expand up 128 6 128 34 describe serverrouter it should select the same route the client router will render angular router resolves each of these to home because and are metacharacters in its url grammar server route matching has to agree or the response s headers status and rendermode are taken from a different route than the one that renders into the body const home route home rendermode rendermode server for const pathname of home home home home expect router match new url http localhost pathname withcontext pathname toequal home an interior ends the path for the client router so user 123 x renders the user id route and must match its server config too expect router match new url http localhost user 123 x toequal route user rendermode rendermode server it should not invent a match for an unknown route expect router match new url http localhost nope tobeundefined it should handle encoded params const encodedusermetadata router match new url http localhost user bob 20 2f 20roberts expand down 49 changes 49 additions 0 deletions 49 packages angular ssr test utils url_spec ts show comments view file edit file delete file open in desktop this file contains hidden or bidirectional unicode text that may be interpreted or compiled differently than what appears below to review open the file in an editor that reveals hidden unicode characters learn more about bidirectional unicode characters show hidden characters original file line number diff line number diff line change expand up 11 6 11 7 import addtrailingslash buildpathwithparams joinurlparts normalizeurlpath stripindexhtmlfromurl stripleadingslash stripmatrixparams expand down expand up 220 4 221 52 describe url utils expect stripmatrixparams tobe describe normalizeurlpath it should resolve spellings that angular router treats as the same route each left hand value is what defaulturlserializer resolves the path to verified against the published angular router 22 1 6 expect normalizeurlpath page tobe page expect normalizeurlpath page tobe page expect normalizeurlpath page tobe page expect normalizeurlpath page tobe page expect normalizeurlpath a 1 b tobe a 1 expect normalizeurlpath a b c d tobe a b it should leave an ordinary path unchanged expect normalizeurlpath page tobe page expect normalizeurlpath a b c tobe a b c expect normalizeurlpath user 123 tobe user 123 expect normalizeurlpath tobe it should preserve encoding including an encoded slash expect normalizeurlpath a 2fb tobe a 2fb expect normalizeurlpath encoding 20url tobe encoding 20url it should preserve matrix parameters so stripmatrixparams still owns them expect normalizeurlpath page p 1 tobe page p 1 it should return a path it cannot parse unchanged malformed percent encoding keeps its existing behaviour expect normalizeurlpath zz tobe zz it should not alter dot segments or index html handling expect normalizeurlpath a b tobe a b expect normalizeurlpath page index html tobe page index html it should still normalize paths a metacharacter only check would skip the fast path is an allowlist for this reason a check that bails out only on and leaves these unnormalized which is the same cheap predicate versus real parser split this function exists to close expect normalizeurlpath a b tobe a 20b expect normalizeurlpath a b tobe a 2bb expect normalizeurlpath 41 tobe a expect normali...
|
|
| Thumbnail images (randomly selected): * Images may be subject to copyright. | |  |
|
Verified site has: 62 subpage(s). Do you want to verify them? Verify pages:
|
The site also has references to the 5 subdomain(s)
|
The site also has 6 references to external domain(s).
|
|
|
Pages verified in the last hours (randomly selected):
|
|
Top 50 hastags from of all verified websites.
| |
|
|
|
|
|
|
Load Info| page size | 76522 | | load time (s) | 1.844668 | | redirect count | 1 | | speed download | 41497 | | server IP | 20.250.119.67 |
|
|
|
|
|
|
|
|
* Image may be subject to copyright.
|
|