Skip to content

Cannot GET -- when don't find the folder language -- example Cannot GET /fr/pr-home #30129

Closed as not planned
@ph360

Description

@ph360

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

router

Is this a regression?

Yes

Description

In app.routes.ts

import { Routes } from '@angular/router';
import { PrHomeComponent } from './pr-home/pr-home.component';
import { PrContactsComponent } from './pr-contacts/pr-contacts.component';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';

export const routes: Routes = [
{ path: '', component: PrHomeComponent},
{ path: 'pr-home', component: PrHomeComponent },
{ path: 'pr-contacts', component: PrContactsComponent },
{ path: '**', component: PageNotFoundComponent },
];

In app.routes.server.ts

import { RenderMode, ServerRoute } from '@angular/ssr';

export const serverRoutes: ServerRoute[] = [
{
path: 'pr-contacts',
renderMode: RenderMode.Prerender,
},
{
path: 'pr-home',
renderMode: RenderMode.Prerender,
},
{
path: '**',
renderMode: RenderMode.Client
}
];

  • if I change the path: 'pr-home' for one with error, for example pr-homefffff

https://pr360v2--pr360-v2.us-central1.hosted.app/es/pr-homefffff the result i show me the follow message

Page Not Found is the content of component PageNotFoundComponent

there the wildcard route ** if work very good the routes.

  • but, if i change the folder the language for one that not exist, for example fr

Cannot GET /fr/pr-home

in this case don't work the wildcard ** in the config the routes.

The result of ng build --localize

Image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

When don't find the folder, after of build app with ng build --localize. see example attachment Cannot GET /fr/pr-home How redirect the folder for default? 

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

Angular CLI: 19.2.6 Node: 22.14.0 Package Manager: npm 11.3.0 OS: win32 x64 Angular: 19.2.5 ... common, compiler, compiler-cli, core, forms, localize ... platform-browser, platform-browser-dynamic, platform-server ... router Package Version --------------------------------------------------------- @angular-devkit/architect 0.1902.6 @angular-devkit/build-angular 19.2.6 @angular-devkit/core 19.2.6 @angular-devkit/schematics 19.2.6 @angular/cdk 19.2.8 @angular/cli 19.2.6 @angular/fire 19.0.0 @angular/material 19.2.8 @angular/ssr 19.2.6 @schematics/angular 19.2.6 rxjs 7.8.2 typescript 5.7.3 zone.js 0.15.0 

Anything else?

No response

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

      close