question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(service-worker): Support ignoring specific URLs

See original GitHub issue

🚀 feature request

Relevant Package

This feature request is for @angular/service-worker

Description

While forcing the SW to ignore specific URL is now possible adding http header ngsw-bypass or ngsw-bypass=true as query param, it’s not possible to specify some URLs to be ignored. This would be very useful when dealing with SDKs like Firestore, that don’t allow to edit the http requests.

Describe the solution you’d like

As discussed in #21191 some workarounds are possible : #21191 (Comment) or 21192 (Comment).

Second comment also contains a suggestion on how to modify SW in order to implement the requested feature. This would mean accepting messages to allow to set a list of URLs to ignore.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
gkalpakcommented, May 15, 2019

WRT https://github.com/angular/angular/issues/30195#issuecomment-492373860: Although there are no immediate plans, we are considering/investigating ways to make the SW more flexible and extensible. It will take a significant refactoring, though, so not going to happen overnight 😁

WRT https://github.com/angular/angular/issues/30195#issuecomment-492383256: Anything involving ngsw-config.json is async (i.e. the SW needs to retrieve the config from the Cache) and thus can’t be used to make a sync decision in onFetch.

3reactions
petersalomonsencommented, May 14, 2019

Another idea:

Add property in ngsw-config.jsonpointing to a .js file containing app-specific code to be executed in the serviceworker (onFetch event). That would be a simple but powerful addition that keeps the SW script independent of the app version, and does not involve code evaluation on the fly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

feat(service-worker): Support ignoring specific URLs (e.g. for ...
I found a fairly simple workaround if you want your SW to completely "ignore" a specific path (for example we had a few...
Read more >
Setting service worker to exclude certain urls only
I have nginx setup to serve /blog/ and it works fine if someone visits /blog/ without visiting the react app first. However because...
Read more >
API Simulator feat. Service Worker - Paul Bakaus' blog
API Simulator allows you to setup any number of static routes (URLs) on the host it runs on, allowing you to test a...
Read more >
Service Workers and Progressive Web Apps (PWA) - InformIT
An introduction to service workers and how to use them to enable cool background processing in your web app.
Read more >
Using Service Workers - Web APIs | MDN
A service worker functions like a proxy server, allowing you to modify requests and responses replacing them with items from its own cache....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found