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

For IPNS to redirect to a custom 404 not found landing page #5916

Open
basile-henry opened this issue Mar 21, 2016 · 4 comments
Open

For IPNS to redirect to a custom 404 not found landing page #5916

basile-henry opened this issue Mar 21, 2016 · 4 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature topic/gateway Topic gateway

Comments

@basile-henry
Copy link

When doing IPNS lookups through DNS using the TXT record trick (dnslink=/ipns/), it would be nice to be able to setup a custom 404 not found landing page.

Right now if a wrong URL is given the following happens:
https://ipfs.io/asdf returns Path Resolve error: no link named "asdf" under QmXkYb9qNw3vHHf5WmK9ckNSW6h1j5j7wAwGL6zG5TtZDP

I've tested on my own IPFS node and it looks like the daemon throws a 505 error code when it can't resolve the path. I don't care so much about which error code it is but I think it would be neat if we could setup a hash for some other content to be served on such error.
This might go against the content addressable property of IPFS though. But maybe there's enough flexibility within IPNS to deal with such a "feature".

The main reason I'm bringing this up is that I seem to understand that for IPFS to replace HTTP or at least to cohabit with it, it should behave in the same way from the user's point of view. Plus a proper landing page on an error is probably more meaningful to the user than a Path Resolve error message.

@jphastings
Copy link
Contributor

At the moment index.html has special meaning for the IPFS -> HTTP gateway, could we give 404.html special meaning too? ie. when presenting any IPFS directory in a browser the /404.html file would be rendered instead of the error @basile-henry noted above.

This would mean that these 404 pages would display on public gateways as well as ones set up to proxy a specific hash.

@daviddias daviddias transferred this issue from ipfs/ipfs Jan 10, 2019
@magik6k
Copy link
Member

magik6k commented Jan 11, 2019

Related PR: #4233

@magik6k magik6k added kind/enhancement A net-new feature or improvement to an existing feature topic/gateway Topic gateway labels Jan 11, 2019
@straiforos
Copy link

I think this is interesting but I do believe it is up to the http server to make this redirect and possibly should be configured in the http gateway. I am not sure if it makes sense for IPNS to be responsible for this logic as this is kind of a p2p DNS service and to link content access with a domain service/api would be a bad abstraction. I am very interested in making a scalable architecture that hosts a plethora of services built on the p2p data sharing peers that IPFS offers both on the public and private networks.

So I think it has merit but I believe the logic belongs at the gateway layer which could be an API gateway or typical web api server model that sends a 404 page and the appropriate headers. Currently working on integrating caddy server v2 into ipfs gateway for secure only access and route users to a insecure webui for insecure connections like a 404 to educate users of the dangers of http access. (slight tangent)

@itsKV
Copy link

itsKV commented Apr 23, 2022

At the moment index.html has special meaning for the IPFS -> HTTP gateway, could we give 404.html special meaning too? ie. when presenting any IPFS directory in a browser the /404.html file would be rendered instead of the error @basile-henry noted above.

This would mean that these 404 pages would display on public gateways as well as ones set up to proxy a specific hash.

Where is the root folder for ipfs public gateway? i.e where to place index.html file to serve that page if user tries to access https://ipfs.example.com/ root domain? I just want to show a welcome message to visitor if he hit a root url.
Currently I am getting 404 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature topic/gateway Topic gateway
Projects
None yet
Development

No branches or pull requests

5 participants