-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular 19 AngularAppEngine angular-app-engine-manifest.mjs needs to be edited when build with --base-href #30082
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
Comments
Hi, I'm having trouble understanding the issue. Since the |
Hi thank you for looking at it. |
From what I understand, the prefix is stripped from the incoming request. So when a user accesses For example:
If this understanding is correct, could you please elaborate on why the internal URL rewrite is necessary? |
The reason is running angular app along with legacy code in java/php. legacy code in java (here we need to load legacy css and javascript files) - urls
angular app (here we need to load angular related js files - that's why we use prefix) urls:
prefix is stripped via nginx so urls can have same format as in legacy app. |
This statement
|
we have 2 nginx server
incoming request: http://url_03
nginx02:
angular is started as when I alter prefix in server/angular-app-engine-manifest.mjs from /prefix to / both languages works
Thank you very much for help with it |
During client-side navigation, if you set the Instead of removing the For example: -location / {
- index index.html;
- try_files $uri @universal;
-}
-location ~ ^/(second_language|)$ {
- try_files $uri @universal;
-}
-location /prefix {
- rewrite /prefix/(.*) /$1;
-}
+ location / {
+ if ($request_uri !~ ^/prefix) {
+ rewrite ^/(.*)$ /prefix/$1 break;
+ }
proxy_pass http://angular:4000;
} Alternatively, if you prefer to hide the The Nginx configuration in this case would look like: location / {
if ($request_uri ~ ^/prefix) {
rewrite ^/prefix(.*)$ $1 break;
}
proxy_pass http://angular:4000;
} Note: Both approaches can also be implemented in a single Nginx instance, removing the need for two separate Nginx configurations. |
Thank you very much for your time and advises. |
We prefer hiding Default one should be:
I assume there is no way to define deploy url per language, right? |
No, it's not possible to define a separate deploy URL for each language. However, using |
Would you say that rewrite base on |
Using Example:
Note: this approach will break |
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Good day,
we need to build our app with --base-href as we include it in legacy code
ng build --base-href /prefix/
We are running it in SSR and multi language setup - SSR 19.2.5 and using subPath
"en-CA": { "translation": "en.json", "subPath": "" }, "fr-CA": { "translation": "fr.json", "subPath": "fr" },
angular-app-engine-manifest.mjs has basePath defined from build line above
export default { basePath: '/prefix/',
in this configuration only first language is loaded but not the second one. To get second language working correctly we need to edit basePath in angular-app-engine-manifest.mjs to "/" after that everything works correctly.
Is there other way around, can we configure basePath for angular-app-engine-manifest?
We used to have a wrapper in angular18 which was loading each language build.
Minimal Reproduction
ng build --base-href /prefix/
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: