Skip to content

Serving from subpath broken in Angular v17 #53552

@arbakker

Description

@arbakker

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

Yes

Description

When serving app from subpath and using a relative base href, the app "redirects" to the root and shows the following error in the console:

ERROR Error: NG04002: Cannot match any routes. URL Segment: 'ng17-base-href'

Issue occurs with Angular v17, and not with Angular v16. See repo with steps to reproduce.

Seems to be related to: #53546

See also this related SO question: https://stackoverflow.com/q/77586659/1763690

Please provide a link to a minimal reproduction of the bug

https://github.com/arbakker/ng17-base-href-issue/tree/main

Please provide the exception or error you saw

ERROR Error: NG04002: Cannot match any routes. URL Segment: 'ng17-base-href'

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.0.7
Node: 20.10.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.0.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.7
@angular-devkit/build-angular   17.0.7
@angular-devkit/core            17.0.7
@angular-devkit/schematics      17.0.7
@angular/cli                    17.0.7
@schematics/angular             17.0.7
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions