-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leverage Service Worker and WebTransport on Public Gateways #207
Comments
Nice! @lidel a few questions:
I am not sure how this would work,
I feel the users should be oblivious to the fact where the content is being loaded from. This should be local first by-default and recover from a public gateway if needed. Other Thoughts
|
Yes, just like you noted, the idea is the gateway will return HTML that loads JS responsible for registering SW. Initially, we would be doing that (A) on HTTP 502 and 504 error pages (show a button, which when clicked, registers worker, and reloads page). This allows us to figure out SW parts without having to implement full gateway (we only implement flat files).
Yes, that would be the endgame for same origin requests send by web browser for the root document. Rationale: start with smaller scope, make things robust first, Reimplementing the full gateway spec in JS to support for anything other than flat deserialized files will be a lot of work, and we need to have a reliable way of testing (gateway tests are wip). |
Dropping some thoughts on core pieces:
|
2023-03-17 Discussion in weekly standup
End Goalbasic plan
potential showoff items
workstreams:
initial action items
open questions
callouts
|
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/html
response (ipfs/boxo#262).Augument
text/html
response 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
The text was updated successfully, but these errors were encountered: