Skip to content

Accessing root address will not redirect to base href #14925

@Nitue

Description

@Nitue

🐞 bug report

Is this a regression?

Yes, the previous version in which this bug was not present was: 7.2.15

Description

When you create minimal application, set the base href (e.g. "/test/") and access http://localhost:4200 instead of http://localhost:4200/test/. You are not redirected to http://localhost:4200/test/ but shown white page containing:

Cannot GET /

In Angular 7, setting the base href will redirect you to http://localhost:4200/test/ when you access http://localhost:4200.

🔬 Minimal Reproduction

You can reproduce the problem by creating a minimal Angular application with the CLI.

ng new angular-basehref-test --interactive=false
cd angular-basehref-test
ng serve --baseHref=/test/

Then go to http://localhost:4200 instead of http://localhost:4200/test/

Setting "baseHref" in angular.json results in the same out come.

🌍 Your Environment

Angular Version:

Angular CLI: 8.0.4
Node: 10.16.0
OS: win32 x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.4
@angular-devkit/build-angular     0.800.4
@angular-devkit/build-optimizer   0.800.4
@angular-devkit/build-webpack     0.800.4
@angular-devkit/core              8.0.4
@angular-devkit/schematics        8.0.4
@angular/cli                      8.0.4
@ngtools/webpack                  8.0.4
@schematics/angular               8.0.4
@schematics/update                0.800.4
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions