Skip to content

ServiceWorker are not using --deploy-url (Followup issue from 9753) #12312

Closed
@naveedahmed1

Description

@naveedahmed1

This is a followup issue from #9753

I tested my app with different configurations and below is my conclusion:

Using an HTML base HREF of https://cdn.domain.com and an Angular APP_BASE_HREF of / doesn't work.

Using an HTML base HREF of https://cdn.domain.com and dynamically setting Angular APP_BASE_HREF to mydomain.com works.

e.g.:

environment.appBaseHref: window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port:'')

{ provide: APP_BASE_HREF, useValue: environment.appBaseHref }

Though the second option works, but it introduces another issue, since we have now set the HTML base HREF to our CDN domain, this breaks other libraries that we are using. For example in my case
we are using other libraries such as Firebase Messaging for Push Notifications. When HTML base HREF is set to CDN it doesn't work.

I think we do need support for --deploy-url

So, when --deploy-url is provided, the urls generated in service worker should have the --deploy-url prepended to the assets.

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