Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Enable SXG Origin Trial on HTTP Gateway #453

Closed
lidel opened this issue Nov 12, 2018 · 2 comments
Closed

Enable SXG Origin Trial on HTTP Gateway #453

lidel opened this issue Nov 12, 2018 · 2 comments
Assignees

Comments

@lidel
Copy link
Member

lidel commented Nov 12, 2018

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

@lidel
Copy link
Member Author

lidel commented Nov 20, 2018

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.

@lidel
Copy link
Member Author

lidel commented Nov 29, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants