Skip to content

Regression: SSR unusable in 19.2.22+ (renderAngular drops allowedHosts) #33184

@robben5566

Description

@robben5566

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

19.2.21

Description

Running ng serve on any Angular 19.2.22+ project with prerender: true or ssr: true throws on the first request with Host http://localhost:4200/ is not allowed, making local development impossible without a workaround.

Root cause: 19.2.22 added an unconditional validateAllowedHosts(url, allowedHosts) check inside @angular/platform-server.renderApplication, but @angular/ssr.renderAngular (the only caller reached from AngularServerApp.handleRendering) never passes allowedHosts. The validator receives undefined, builds an empty Set, and rejects every request. Last working version is 19.2.21 (the validator did not exist there yet).

Minimal Reproduction

⏺ Reproducing only requires creating a default SSR project — no extra code or config changes needed.

ng new my-app --ssr --defaults
cd my-app
ng serve

Then visit http://localhost:4200/ and the error throws immediately on first request.

Exception or Error

Host http://localhost:4200/ is not allowed. You can configure `allowedHosts` option.

Your Environment

Angular CLI: 19.2.25
Node: 20.19.4
Package Manager: npm 10.8.2
OS: darwin arm64

Angular: 19.2.22
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.25
@angular-devkit/build-angular   19.2.25
@angular-devkit/core            19.2.25
@angular-devkit/schematics      19.2.25
@angular/cli                    19.2.25
@angular/ssr                    19.2.25
@schematics/angular             19.2.25
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.1

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions