Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

Service Worker works behind Authentication?Β #176

@mattma

Description

@mattma

Trying to run Service worker behind Authentication. It works 100% without Authentication. Once I enabled the auth, I failed with (401 Authentication) getting the $SITE_URL/ngsw-manifest.json?...$timestamp$...

Because the service worker cannot read the file of ngsw-manifest.json, none of those assets is being downloaded to the browser cache.

By reading the source code of service worker, currently refresh method with req url, $SITE_URL/ngsw-manifest.json?...$timestamp$... is being loaded with Fetch API.

Current option for the fetch api when it requests ngsw-manifest.json that behind of Authentication is

        request.mode = 'cors';
        request.credentials = 'omit';

What if i changed to

        request.mode = 'no-cors';
        request.credentials = 'include';

Is it supposed to work? Do @alxhub have any suggestion on how to work around this issue? thanks

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