Go-ipfs: ipns gateway show resolution in headers

Created on 7 Dec 2015  路  7Comments  路  Source: ipfs/go-ipfs

would be nice if the headers of the http request to a /ipns/... path showed the resolution steps:

> curl -I http://voxelot.us/ipns/foo.com
HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Content-Length: 4438
Content-Type: text/html; charset=utf-8
Last-Modified: Mon, 07 Dec 2015 16:41:41 GMT
Suborigin: foo.com
X-Ipns-Path: /ipns/foo.com 
X-Ipns-Resolution: /ipns/foo.com /ipns/QmUqBf56JeGUvuf2SiJNJahAqaVhFSHS6r9gYk5FbS4TAn /ipfs/<resolved-hash-here>
X-Ipfs-Path: /ipfs/<resolved-hash-here>
Date: Mon, 07 Dec 2015 16:41:41 GMT
help wanted kinenhancement topigateway

All 7 comments

  • added X-Ipns-Resolution (all steps)
  • added X-Ipns-Path (ipns root path)
  • changed X-Ipfs-Path (to show _ipfs_ path, not ipns path)

I decided to take a crack at this. (I am quite new to golang, and this seemed simple enough.)
"X-Ipfs-Path" is "X-IPFS-Path" at the moment, and has the old behavior of returning a (non-root) ipns path upon requests to ipns paths. I assume we are okay with changing it to "X-Ipfs-Path". Looks better imo, and header keys are case-insensitive, so it shouldn't matter.

Are you sure you want X-Ipns-Path to return an ipns root path? Imo it would make more sense to return the full ipns path. X-Ipns-Resolution would already contain the ipns root path.

I noticed today that gateway are still returning an IPNS path instead of an IPFS path in x-ipfs-path (both on ipfs.io and cloudflare-ipfs.com). It would be nice to get the actual hash and have a separate header for IPNS.

At this point, I'd rather leave X-IPFS-Path and add some X-IPFS-Resolved header (or something like that).

Rational: addons like the browser companion are using the X-IPFS-Path header to detect resources available on IPFS. That is, we're treating this header as a "content also available here" header.

@agentofuser up for writing a patch (core/corehttp/gateway_handler.go)?

@Stebalien good point. I haven't used Go before but this seems like it would be a good way to get acquainted with it. I'm working on ipfs-deploy at the moment and need some things from js-ipfsd-ctl that I want to contribute back too, so it'll probably take me some time to get around to this issue. If more people show interest I can bump its priority in my queue.

Given the age of this issue, you can probably take your time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kallisti5 picture kallisti5  路  3Comments

magik6k picture magik6k  路  3Comments

emelleme picture emelleme  路  3Comments

zignig picture zignig  路  3Comments

ArcticLampyrid picture ArcticLampyrid  路  3Comments