-
Notifications
You must be signed in to change notification settings - Fork 26
Leverage Service Worker and WebTransport on Public Gateways #207
Copy link
Copy link
Open
Labels
epickind/discussionTopical discussion; usually not changes to codebaseTopical discussion; usually not changes to codebasekind/enhancementA net-new feature or an improvement to an existing featureA net-new feature or an improvement to an existing featuremaking the caseneed/community-inputNeeds input from the wider communityNeeds input from the wider communityneed/maintainers-inputNeeds input from the current maintainer(s)Needs input from the current maintainer(s)
Metadata
Metadata
Assignees
Labels
epickind/discussionTopical discussion; usually not changes to codebaseTopical discussion; usually not changes to codebasekind/enhancementA net-new feature or an improvement to an existing featureA net-new feature or an improvement to an existing featuremaking the caseneed/community-inputNeeds input from the wider communityNeeds input from the wider communityneed/maintainers-inputNeeds input from the current maintainer(s)Needs input from the current maintainer(s)
This is a stub/meta issue for tracking work to leverage Service Workers (SW) as a fallback on public gateways.
Broad strokes idea
/ipfs/cid/or/ipns/id) and load data using/routing/v1/providers/cid?cascade=ipfs-dht)Prior art
There are two ways one can fetch blocks:
I think the thing we want to create something robust that does do both, and use all public gateways as a fallback
Open questions
When SW is registered / used
First HTTP GET will always hit the gateway. Response could register worker and reload.
Future requests will hit SW, as long they come from the same Origin (see "no foreign fetch" below)
No foreign fetch
tldr: this means SW is active only if the root document loaded in the browser comes from the same Origin.
Use case ideas
(A) Client-side recovery
When gateway returns error (list tbd, could be 429 and maybe also 502 503 and 504), and it knows request comes from web browser, return
text/htmlresponse (ipfs/boxo#262).Augument
text/htmlresponse to include an option to recover from page load error via a Service Worker IPFS node.This is a good candidate for dipping our toes, does not impact "successful" flow, but allows for recovery from 429 Too Many Requests and Saturn CDN hiccups we will see in the near future.
Recovery could be based on Helia and WebTransport and/or verifiable HTTP block/car requests to public gateways
(B) Ability to register global worker
Giving user ability to prefer local JS for future requests, not only for errors, but all responses.
(C) Ability to isolate path gateway
We could do something related to #157 where actual payload is loaded in sandboxed iframe