How to serve application Assets from cdn in Angular

This issue has been created since 2022-09-14.

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

platform-browser-dynamic, platform-browser, router

Is this a regression?

Yes

Description

We want to serve our application from cdn all bundles and assets(images , icons , fonts etc.) but the problem is when we are using --deploy-url flag during build it only fetch bundle files (main.js etc) from cdn but still all assets are coming from server but when use --base-href flag it thrown these error
Unhandled Navigation Error: SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL
and application is not getting loaded and we didn't want to use hash strategy for our application is there any way we can server all assets from cdn ?

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Unhandled Navigation Error: SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL

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

Angular CLI: 13.3.9
Node: 16.15.0
Package Manager: npm 8.5.5
OS: win32 x64

Angular: 13.3.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1303.9
@angular-devkit/build-angular      13.3.9
@angular-devkit/core               13.3.9
@angular-devkit/schematics         13.3.9
@angular/cdk                       13.3.9
@angular/cli                       13.3.9
@angular/localize                  14.2.0
@angular/material                  13.3.9
@angular/material-moment-adapter   13.3.9
@schematics/angular                13.3.9
rxjs                               6.6.7
typescript                         4.6.4

Anything else?

No response

JoostK wrote this answer on 2022-09-14

This issue is still missing relevant details for us to understand the problem you're experiencing, and what the cause of this issue might be. Please provide a minimal reproduction if you think this is an Angular bug; for support questions I'd request that you'll ask on platforms such as StackOverflow instead of the issue tracker here.

atscott wrote this answer on 2022-09-21

This is somewhat described in https://angular.io/guide/deployment#the-deploy-url.

The base href can also be used to define the Angular router's default base (see APP_BASE_HREF). Users with more complicated setups may need to manually configure the APP_BASE_HREF token within the application (for example, application routing base is / but assets/scripts/etc. are at /assets/).

That is, it sounds like you want to use <base href="..." /> in your index.html and also want to provide a different APP_BASE_HREF for routing purposes.

In addition this issue doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular.

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

More Details About Repo
Owner Name angular
Repo Name angular
Full Name angular/angular
Language TypeScript
Created Date 2014-09-18
Updated Date 2022-09-30
Star Count 84080
Watcher Count 3064
Fork Count 22235
Issue Count 1197

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
*** required a bean of type ***Repository that could not be found. 3 2020-02-01 2022-08-18
My fork with Windows support 5 2019-06-27 2022-08-31
SwiftUI support require 2 2021-10-25 2022-06-16
Crashed with error message "High load: heatmap_and_stuff took 4113 ms!" 6 2021-09-24 2022-05-10
readsb ogn2dump1090 2 2021-08-06 2022-01-12
sdr device support 2 2021-06-04 2021-12-24
LF vs CRLF 1 2021-10-29 2022-01-03
SignIn option does not show the app logo 0 2021-01-16 2022-09-22
Steam game from other folder than steam install folder not detected has installed 3 2021-06-08 2022-09-16
[>=3.2.1] Compile error with GCC 9.2 — error: must '#include <typeinfo>' before using 'typeid' 6 2022-02-05 2022-09-24
Remaining Sphinx warnings 6 2022-04-27 2022-09-13
Teensyduino 1.57 has been released 0 2022-07-29 2022-09-01
Scheduar is not picking up the execution 11 2021-11-11 2022-09-17
ImportError: cannot import name 'circle' from 'skimage.draw' 1 2021-12-13 2022-09-06
Flatpak using Nvidia 510 driver 5 2022-04-24 2022-08-31
Is webhooks or event based subscription supported in mimekit ? 1 2022-06-13 2022-09-13
Not working with outlook addin project using angular 9 4 2021-12-31 2022-09-21
Change how upload and deletion of images to Surveys. 6 2021-04-26 2022-09-12
Add enable props 4 2020-10-10 2022-01-17
Provide `path` for `snapshot_review()` hint 1 2022-02-17 2022-09-05
Issue on the test image file 1 2021-11-12 2022-09-14
file not found when mime file doesn't exist 1 2020-12-17 2022-05-17
Having more than one value in AUTH_PROVIDERS throws an error 2 2022-03-26 2022-09-21
Scene condition: Schedule from 10pm to 4am not working 5 2021-10-17 2022-09-05
msw test breaking 6 2021-03-28 2022-01-18
Track: full subquery support and optimization 0 2022-07-05 2022-07-09
Failed to store tunnel 0 2022-07-18 2022-09-11
Revise logging output 0 2022-01-30 2022-08-21
The Support button goes to a closed User Voice page. 0 2021-09-21 2022-08-16
Inconsistent documentation of instance limit 8 2020-07-04 2022-08-18
Bump node-fetch from 2.1.2 to 2.6.1 1 2020-10-30 2022-07-26
[google_mobile_ads] Missing API Documentation 1 2021-08-03 2022-08-05
Account recovery request 1 2021-07-19 2022-07-27
Alertes code du travail : distinguer les fiches et les contributions ? 2 2021-07-13 2022-08-02
Does the connector check index existence on every neo4j restart? 8 2016-07-31 2022-08-03
Update "docker swarm leave" for destiny of worker's containers 0 2022-08-20 2022-08-30
富文本编辑器rich-text,嵌套在dialog、drawer中使用,rich-text的菜单层被遮盖,z-index 是准确 4 2022-09-05 2022-09-20
iframe capture with blank 2 2021-09-23 2022-07-17
Is it possible to get supported Cameras in Flutter? 1 2021-11-11 2022-08-10
Plot not rendering in PowerPoint presentation 20 2021-06-03 2022-09-07
Python bindings missing transform copy 3 2021-07-12 2022-09-21
KSP default annotation arguments cause a NullPointerException 5 2022-08-31 2022-09-23
Deadlocking in start_item_crawler_thread 2 2022-03-30 2022-09-28
Not compatible with Rasa 2.3+ 3 2021-02-19 2022-09-13
Inconsistent CUDA toolkit path: /usr vs /usr/lib 7 2022-07-25 2022-09-24
SlurmClusterResolver cannot be configured to use no GPUs 8 2022-07-25 2022-09-27
[Feature request] pathFilters to support regex or wildcard characters 1 2021-09-14 2022-09-25
How to explicitly run model validation as part of a unit test in EF Core 6 2 2022-04-29 2022-09-10
Nullability check in in-memory provider does not recognize default value 4 2022-04-29 2022-07-28
A part of lambda improvements feature doesn't work with latest SDK 6.0.101 10 2021-12-15 2022-09-08