I have often and repeatedly complained here and otherwise that we have many canisters using the HTTP Gateway feature, and multiple implementations of a gateway (icx-proxy
, as running on the boundary node, or on your own systems if you use icfront
, and the service worker).
Given that community contributions will possible since last week , I felt compelled to stop complaining and start fixing this.
dfinity:master
← nomeata:joachim/http-gateway
opened 12:22PM - 01 Apr 22 UTC
We have had the HTTP gateway for a while now, but
* we didn’t have a public … record of the expected Canister interface, with the authorative Candid fragment
* we already have multiple implementations (`icx-proxy` and the service worker), and people we looking at the implementations to understand how thing work.
* we see new features being implemented in one, but not the other implementation, and they start to diverge
* some features are only implementation-defined (e.g. the certification fallback to `index.html`)
* the interaction of new features (e.g. certificate, upgrade to update and streaming) is ill or at least vaguely defined.
So I think we urgently need a proper specification for the HTTP Gateway protocol, and a place to host this. The IC Interface Spec is a natural place, so here is a possible start.
This PR is descriptive, not prescriptive, with regard to the status quo: I (try to) specify the existing behavior of our Gateway implementations, not define a new and different protocol.
contains a suggested specification for this interface, including certification. Technical comments about phrasing etc. are welcome there, maybe the less technical chatter is better kept here.
I don’t have a easy link to a nice rendering of PRs, happy to help with that, too , though.
@paulyoung , can I invite you to review that PR too?
Hopefully we soon have an authoritative source of truths for this feature.
5 Likes
I added some comments. Great idea to put this protocol into writing!
Thanks for your good comments! Good to see such community collaboration!
So does this mean that StreamingCallback can be used, is there any demo code for reference?
I don’t know if it actually works, but this code seems to use that feature:
let streaming_strategy = create_strategy(asset, enc_name, enc, key, chunk_index);
HttpResponse {
status_code: 200,
headers,
body: enc.content_chunks[chunk_index].clone(),
streaming_strategy,
}
}
1 Like
Thanks for doing this. It may take me longer than usual to review things at the moment. Thanks for understanding.