ipfs / infra

Tools and systems for the IPFS community

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable SXG Origin Trial on HTTP Gateway

lidel opened this issue · comments

For a wider IPFS context on Signed HTTP Exchanges and WebPackage
see parent issue ipfs/in-web-browsers#121 and ipfs/in-web-browsers#121 (comment)

A good TL;DR on current SXG Origin Trial is in this post at developers.google.com.

Summary

b2 implementation snapshot of SXG is supported by Google Chrome 71 as a part of opt-in Origin Trial.

We've received token from Google Chrome Team for use on ipfs.io.
(via https://bit.ly/OriginTrialSignup)
Remaining work is to set our gateway to return it with every /ipfs/*.sxg

Required HTTP Headers

To participate, these headers should be returned with every .sxg file returned by our gateway:

Content-Type: application/signed-exchange;v=b2
Origin-Trial: AoNMhcfAN9G0rKV6+fmRdoU2UfSaFadhfjSq0QJYB1yNP+f8sM6Rz0SmQNNBbVkJOzIQ3MwLzef4YaJ/ZpBOUQwAAABeeyJvcmlnaW4iOiJodHRwczovL2lwZnMuaW86NDQzIiwiZmVhdHVyZSI6IlNpZ25lZEhUVFBFeGNoYW5nZU9yaWdpblRyaWFsIiwiZXhwaXJ5IjoxNTQ1MjczODI3fQ==

In other words, we need something along these lines (nginx pseudocode, probably needs refinement):

location ~ ^/ipfs/.*\.sxg$ {
  proxy_hide_header Content-Type;
  add_header Content-Type "application/signed-exchange;v=b2";
  add_header Origin-Trial "AoNMhcfAN9G0rKV6+fmRdoU2UfSaFadhfjSq0QJYB1yNP+f8sM6Rz0SmQNNBbVkJOzIQ3MwLzef4YaJ/ZpBOUQwAAABeeyJvcmlnaW4iOiJodHRwczovL2lwZnMuaW86NDQzIiwiZmVhdHVyZSI6IlNpZ25lZEhUVFBFeGNoYW5nZU9yaWdpblRyaWFsIiwiZXhwaXJ5IjoxNTQ1MjczODI3fQ==";
  proxy_pass http://127.0.0.1:8080;
}

References

hey @mburns any news on this?

fyi Origin-Trial token listed above expires on 2018-12-20. We will probably need to switch to a new one after that date – when you add it to gateway config keep in mind it should be easy to find/configure/toggle this value.

Update: this just landed! ❤️

Headers are in place (current Origin-Trial token valid until 2018-12-22):

$ curl -s -I -X GET https://ipfs.io/ipfs/QmVnnXjwXyEKhnrC1L7wegepUum2zN4JZUgtvA7DYtj4rG/sxg-location.sxg | egrep -i '(Content-Type|Origin-Trial)'
Content-Type: application/signed-exchange;v=b2
Origin-Trial: AoNMhcfAN9G0rKV6+fmRdoU2UfSaFadhfjSq0QJYB1yNP+f8sM6Rz0SmQNNBbVkJOzIQ3MwLzef4YaJ/ZpBOUQwAAABeeyJvcmlnaW4iOiJodHRwczovL2lwZnMuaW86NDQzIiwiZmVhdHVyZSI6IlNpZ25lZEhUVFBFeGNoYW5nZU9yaWdpblRyaWFsIiwiZXhwaXJ5IjoxNTQ1MjczODI3fQ==

I smoke-tested it in Chrome 71 – works as expected:

Thanks!

Anyone interested in this, follow ipfs/in-web-browsers#121