-
Notifications
You must be signed in to change notification settings - Fork 12k
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
remove Option "deployUrl" is deprecated warning #23765
Comments
It is expected that baseHref does not prefix the paths of scripts tags. See #22485 Based on the description in stackoverflow, you need to run the below command and be sure that you are using the index file generated by the Angular CLI.
|
This is THE PROBLEM! Here's scripts in generated index.html when I do not use
and this is WITH
Tell me, HOW would I achieve same result without this option? ( |
That is working as intended as |
Well, the problem is I host angular app in ASP.NET and there this path is required. But I may be wrong, let me double check... |
Without deployUrl what is the option to distribute static assets from a CDN? We currently have a few applications that we host on internal Apache servers in our DC but we use a CDN to speed up the loading of static assets, this reduces the load 10x and improves speed 10x for external clients that have to use our Reverse Proxy mapping. Our main.js file for example goes from 4s to less than 500ms to load. My question is pretty simple, what is the alternative to deployUrl? How can we support loading our static assets and elements from the CDN distribution, without having to resort to mod_rewrite or other cumbersome solutions, or even worse have to write and maintain code to handle something the framework should provide out of the box. Currently we use base href to serve the app and deployUrl for the static assets, since we append the CDN distribution URI to src properties in this way. |
@webmutation, In your case, you would need to use a combination of both
app.module.ts
In an ideal setup however the entire application would be fronted by a CDN. |
Thanks Alan, so if I understood correctly the proposed solution we have to overwrite the value of base href with the APP_BASE_HREF Token, but will that not affect as well the loading of the elements? Our elements are distributed as part of the assets folder /assets/elements/remote-el-xyz ng b --base-href="http://cdn-url.com/" Our host app is merely a shell all the modules are elements that get dynamically loaded.
We are not able to to host fully on CDN due to data protection policy for the API calls to not leave the DC, static assets are fine, no sensitive data, but backend calls contain sensitive data, hence the use of the reverse proxy. The previous syntax seemed more obvious, base-href for app, deploy-url for assets, clear separation of concerns. Now it will require additional insight to understand what APP_BASE_HREF does. In any case, thank you for the proposed solution we will try and see if we hit any hickups. |
"The previous syntax seemed more obvious, base-href for app, deploy-url for assets, clear separation of concerns." That is 100% true. Why make things more complex, angular team? |
The main reason for this change is that Nowadays, however hosting the entire application on CDN and promoting the bundle from one environment to another are more common and considered a better practice.
But you can host the frontend which is a static HTML file (unless you use SSR) on CDN and API (Backend) in the data center. With this approach you get a simpler setup while still be compliant with your data protection policy. |
ok, understood. Let me try to change things in my project... |
Indeed this is where we want to move towards, we finally got our BFF authentication mechanism to work on the CDN, however given this is a European Institution website, any changes require a lot of approvals, in particular this one that has more than a dozen stakeholders... so hopefully we will be able to move fully to CDN and serverless by the end of the year... until then we still need to use this hybrid Apache+CDN approach. |
@webmutation, until then you can use the deprecated option 😀. |
@alan-agius4 with the deprecation of Deprecating |
ok, I just tried this scenario with just
The whole angular app resided in
This might be an ASP.NET issue but please notice this is the browser that actually issues the request! |
please see this - https://stackoverflow.com/q/73640112/2896495 |
The only issue with using PS: In the edge case, the assets sit in |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I add this issue again. Before someone close it (again), please answer this - https://stackoverflow.com/q/71548735/2896495. How should I make the dist to have scripts point to the right folder (
ngxapp
):I use the following command to build my angular app and publish it with a back-end made using .NET:
And it's a bit annoying to see this warning:
There's no way
deployUrl
is deprecated. Please remove this warning.OS: Windows 11
The text was updated successfully, but these errors were encountered: