Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around gateway's trailing-slash redirects #8

Closed
flyingzumwalt opened this issue Feb 7, 2017 · 2 comments
Closed

Work around gateway's trailing-slash redirects #8

flyingzumwalt opened this issue Feb 7, 2017 · 2 comments
Labels
developers status/ready Ready to be worked topic/dependencies Topic dependencies

Comments

@flyingzumwalt
Copy link
Contributor

Background

@Gozala (2017-02-01):

IPFS node automatically redirects if path is for the directory but without / at the end. As a side effect following redirect happens:

fs://ipfs/${cid}/dir -> localhost:8080/ipfs/${cid_v1_base16}/dir/

While it would make more sense to either redirect as

fs://ipfs/${cid}/dir -> ipfs://${cid_v1_base16}/dir/

or redirect and 404 here

fs://ipfs/${cid}/dir -> ipfs://${cid_v1_base16}/dir

Obviously former would be more preferable, but somewhat unclear how to do that given that protocol handler has no knowledge of what’s actually under the requested URL

@flyingzumwalt flyingzumwalt changed the title Gateway handle trailing slash redirects like a web server Gateway handles trailing slash redirects like a web server Feb 7, 2017
@flyingzumwalt flyingzumwalt added the topic/dependencies Topic dependencies label Feb 9, 2017
@flyingzumwalt flyingzumwalt added the status/ready Ready to be worked label Feb 14, 2017
@ghost
Copy link

ghost commented Mar 28, 2017

Example: https://ipfs.io/ipns/ipfs.io redirects to https://ipfs.io/ipns/ipfs.io/ -- this also breaks the "fake fs: path" in the address bar with the firefox addon.

We need this behaviour so that relative links in e.g. HTML documents always work.

One way around this issue is to set a special header in gateway requests from browser addons, and adjust the redirects in the gateway accordingly:

GET /ipns/ipfs.io HTTP/1.1
X-Redirect-Proto: dweb:

HTTP/1.1 301 Moved Permanently
Location: dweb:/ipns/ipfs.io/

@ghost ghost changed the title Gateway handles trailing slash redirects like a web server Work around gateway's trailing-slash redirects Apr 18, 2017
@ghost ghost added the developers label Apr 18, 2017
@lidel
Copy link
Member

lidel commented May 4, 2020

I believe this old enough to be closed.
Addressing nuances will be tackled in https://github.com/ipfs/in-web-browsers/issues/147
(linking so we can refer back to this issue)

@lidel lidel closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developers status/ready Ready to be worked topic/dependencies Topic dependencies
Projects
None yet
Development

No branches or pull requests

2 participants