Can't specify allowed hosts in ng serve · Issue #64104 · angular/angular · GitHub
Skip to content

Can't specify allowed hosts in ng serve #64104

Description

@Lysoun

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

No response

Description

Following the vite documentation, I should be able to give specific allowed hosts, as a string array. In the Angular documentation, it does not seem to be possible because the option value type is only boolean. Hoping the documentation would be lying, I tried to specify a string array. It does not work, I get this error:

➜  app git:(main) ng serve --allowed-hosts my.host1.com 
Error: Invalid values:
  Argument: project, Given: "my.host1.com", Choices: "app"

I should be able to specify a given array of hosts to ng serve, since it is indeed an option in the vite documentation.

Minimal Reproduction

To reproduce the issue, you can just create a new app using ng new and try the command ng serve --allowed-hosts my.host1.com. Here is the app I tried it on: https://github.com/Lysoun/angular-ng-serve-allowed-hosts

Exception or Error

Error: Invalid values:
  Argument: project, Given: "my.host1.com", Choices: "app"

Your Environment

Angular CLI: 20.3.3
Node: 22.16.0
Package Manager: npm 10.9.2
OS: darwin arm64
    

Angular: 20.3.2
... common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2003.3
@angular-devkit/core         20.3.3
@angular-devkit/schematics   20.3.3
@angular/build               20.3.3
@angular/cli                 20.3.3
@schematics/angular          20.3.3
rxjs                         7.8.2
typescript                   5.9.2
zone.js                      0.15.1

Anything else relevant?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: docsRelated to the documentationgood first issueLabel noting a good first issue to be worked on by a community memberopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions