pcb icon indicating copy to clipboard operation
pcb copied to clipboard

Allow for dynamic service worker public path

Open dr3 opened this issue 5 years ago • 0 comments

Is your feature request related to a problem? Please describe. This is likely a very unique case to us, however I think we need the ability to generate a dynamic public service worker public path. We have a single application which uses a service worker, however due to how our application is routed the same service worker is used in two locations.

Page 1 - bbc.com/news/articles/c123456789o SW 1 - bbc.com/news/articles/sw.js Page 2 - bbc.com/persian/articles/c987654321o SW 2 - bbc.com/persian/articles/sw.js

Page 1 & 2 both use the same application bundles, and SW 1 & 2 are the same service worker files, routed in two locations, however the service worker needs 2 public paths depending on what route you use the application from.

Unfortunately we are unable to put our service worker at bbc.com/sw.js

Describe the solution you'd like Allow the service worker public path to be a function that executes at run time within the browser.

Describe alternatives you've considered None come to mind but if anyone has any ideas on possible alternative solutions we would love to discuss them.

Thanks :)

Our repo - https://github.com/bbc/simorgh

dr3 avatar Feb 07 '19 10:02 dr3