Skip to content

configurable key for ngsw-bypass in service-worker #46984

Closed as not planned
Closed as not planned

Description

@9thQuadrant

Which @angular/* package(s) are relevant/related to the feature request?

@angular/pwa

Description

A customizable key for ngsw-bypass would be great if we can include some set of headers from ngsw-config.json
Also exclude URLs for API calls would be very helpful

Proposed solution

A field in ngsw-config.json giving option to omit in ngsw-worker.js

Alternatives considered

Right now, Im replacing the ngsw-bypass with Authorization to by pass all our API calls

Activity

  1. nikithamunigala193 commented on Jul 28, 2022

    @nikithamunigala193

    Waiting for resolution

  2. bluestar39 commented on Jul 28, 2022

    @bluestar39

    +1

  3. gkalpak commented on Jul 28, 2022

    @gkalpak
    Member

    Unfortunately, this is not possible at the moment. The reason is that the ngsw.json manifest that corresponds to each client is retrieved asynchronously, while the decision on whether to bypass the service worker or not has to be made synchronously.

    Therefore, the logic for deciding this needs to be embedded into the service worker code and cannot depend on the configuration. #21197 will provide a way to address this, but there are not concrete plans on implementing it.

    I am going to close this issue (in favor of #21197), but feel free to continue the discussion below.

  4. 9thQuadrant commented on Aug 1, 2022

    @9thQuadrant
    ContributorAuthor

    What I meant is the string ngsw-bypass inside the generated service worker must be dynamic and configurable from ngsw-config.json. This change would not be runtime, just a build time.

  5. gkalpak commented on Aug 1, 2022

    @gkalpak
    Member

    The SW script is fixed and does not change at build time. The only thing that happens at build time is that ngsw-config.json is processed and converted to ngsw.json. The the SW will retrieve and use ngsw.json at run time.

    So, without #21197, there is no way to modify the SW script at build time.

  6. angular-automatic-lock-bot commented on Sep 1, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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