Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ph360 opened this issue Apr 18, 2025 · 1 comment

Comments

@ph360
Copy link

ph360 commented Apr 18, 2025

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

@ph360 ph360 changed the title Cannot GET -- when don't find the folder language -- example Cannot GET /es2/pr-home Cannot GET -- when don't find the folder language -- example Cannot GET /fr/pr-home Apr 18, 2025
@JeanMeche JeanMeche transferred this issue from angular/angular Apr 18, 2025
@alan-agius4
Copy link
Collaborator

This behavior is expected because no Angular application is not mounted at /fr/. The ** route applies after the localized base href. For example, /es/**. This is similar to a missing resource scenario, where a custom middleware in the chain can handle the response.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants