ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.15k stars 3.01k forks source link

Support /ipfs/ absolute paths for gateway when Host header is set #4788

Open singpolyma opened 6 years ago

singpolyma commented 6 years ago

Type:

Feature

Description:

Today, when making a request to the HTTP gateway with Host header set, it does dnslink lookup and serves the content at that hash. This is great for hosting a website directly off IPFS. However, when I want to put links in my website to other content on IPFS, I want to use the correct href="/ipfs/hash" style. When viewing content on a gateway this works, when viewing content with the IPFS-companion this works, but for a "normal" browser using my domain with Host header request to the gateway it results in an error (no link named ipfs)

Please allow /ipfs absolute paths to be resolved even when Host header is used.

Stebalien commented 6 years ago

This is a bit tricky as it would conflict with any ipfs directory inside the website itself. However, it would definitely be useful.

singpolyma commented 6 years ago

Hmm... it's also possibly a security issue, since anyone could get content to "show up under your domain". But I'd really like to be able to link to ipfs content using just href="/ipfs/Qm..."

sixcorners commented 6 years ago

This seems like a duplicate of #3902. If you know the things you want to link to you could add an /ipfs/ directory to your content with hashes that point to the right place.