-
Notifications
You must be signed in to change notification settings - Fork 324
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
Support website hints to reroute HTTP query to IPFS #16
Comments
What about URLs like browsers (or proxies) that don't know about |
Yes, that also sounds good! Cool idea by
Right now I plan to support in this add-on (redirect request to a custom gateway, if enabled):
This add-on already supports (v1.0.1) |
Wait. Reading https://tools.ietf.org/html/rfc5785#page-3 we need to make sure that we follow the rules
(...)
|
Ouch.. I am bit torn now. I guess you could say
? |
I think something like
To make it unique and 'fs'-ish, we could use I'm not so keen about |
You are right. Forcing URL convention would probably fail. One way would be to provide a hint for browser add-ons without need to change already existing URLs. I thought about it and a special HTTP header sent by server could be a way to do it. For example CMS, web server or even load-balancing proxy could add this header to HTTP response:
Does it sound ok? |
IMO having a response header makes the information come “too late”: we don't even want to query the web server if we can ask ipfs. |
Yes, my thinking was that the special header would be returned only for the root document (I updated sample above), giving a hint that all page assets are under specific IPFS hash, eg.
Not sure how useful it would be tho.. |
I agree with @Fil, a HTTP header would be too late and ruin the decentralized nature of ipfs. I think a better solution would be for the ipfs gateway to expose an api for doing dns queries. That would enable our extensions to check if a requested domain has a dns txt record for ipfs set and redirect to that if available. Then instead of typing /ipns/ipfs.git.sexy/ you could simply type ipfs.git.sexy/. Those without the extension would visit the centralized site, and those with the extension would visit the decentralized version. |
I like this idea: detecting IPFS hint at the DNS level is early enough to avoid any HTTP request to original server. I quickly glanced over Firefox APIs and it seems add-ons can only read |
I want to remind everyone here that we're not actually limited by any rules. It is of course convenient and nice to work productively with everybody else, but there are certain mistakes we should not continue to make. I'll give you an example of a break from tradition (or rather... a return to even older tradition). it is a strong goal to mend the rift between UNIX and the Web. That is, "ipfs links" should be exactly the same in both the Web, and UNIX. meaning:
please don't do this. please please please have identifiers exactly how we have them, everywhere. Simply
I suggest: Also, I'm not sure this is the right approach. Instead of forcing people to change links, it may be easier to implement both an http proxy and an extension that checks a
much better idea, though note at this point the request already happened (as @Fil and @dylanPowers note). Also, we already return this:
Are you thinking of anything beyond the Good discussion! 👍 👍 |
@jbenet nothing beyond what's already in the dns. We simply need access to dns and there aren't any browser api's that can do that |
Keeping 'canonical' URI consistent across applications is a very good point.
Yeah, I could not find any pre-existing convention for this kind of hint.
At this point we only need JSON API that consumes HTTP URL (or just a domain in FQDN format) and returns URI Example: Request: { uri: "http://ipfs.git.sexy/index.html" } Response: { uri: "/ipns/ipfs.git.sexy/index.html" } FQDN Example: Request: { fqdn: "ipfs.git.sexy" } I think that instead of POST, a simple HTTP GET Response: { uri: "/ipns/ipfs.git.sexy/" } Not sure which one is more practical, maybe the FQDN one would be enough? What are your thoughts on this? |
@lidel i like this a lot. On URI vs FQDN, i think we could support both. i think for the exact apis, we'll want a few different formatted ones, too. For example:
|
Just got this idea: it would not hurt to return both Sample response for {
ipns: "/ipns/ipfs.git.sexy/",
ipfs: "/ipfs/QmVyS3iAy7mvDA2HqQWm2aqZDcGDH3bCRLFkEutfBWNBqN/"
} Use case: one wants to share a link to a specific revision of IPNS resource. |
@lidel yep, that lgtm. |
@lidel we should probably move this discussion to go-ipfs or somewhere to implement this. |
Yes, we should continue DNS talk in ipfs/kubo#1054 (I've put a summary of this discussion there). |
Another possible hint from a web site is hosting IPFS content simply on Example: http://ipfs.pics/ipfs/Qmen4mpfUAnsh98hCZPr1DKUjJFuuAYfsAzjNdYY9R637i |
A related discussions: ipfs/notes#73 / ipfs/notes#92 |
@Mithgol regex-based URL matching will not work – it produces false-positives such as the one described in #43 (good thing that functionality is disabled by default and marked as experimental). As a half-measure it is now possible to manually specify multiple "public gateway" hosts in the Properties screen: If we want automatic detection of resources that can be redirected as-is, I think something like ipfs/notes#92 could be the solution for this particular use case. Until then, we can implement |
What if a regular expression is made very specific to prevent false positives? For example, the current IPFS multihash (the one that uses SHA2-256) seems to be always 46 characters long, and starts with It means that, while a simple regex (such as |
Problem with rerouting is that some sites need special treatment, see: ipfs/notes#92 (comment) (I think I identified all cases (Edit 3)). Also #45. |
Thank you for explaining, now I understand that some sites might really want to be not redirected to a local gate. However, I still have some arguments for most sites to be served from local IPFS gates by default, while the suffering minority should be given an interface to opt out of such rerouting. See ipfs/notes#92 (comment) for details of these arguments. |
FYI the latest version (1.5.0 at AMO) provides an experimental feature related to this discussion:
It is disabled by default and needs to be enabled in Preferences: Lookups are done via XHR requests to This is just a PoC. Current performance is quite poor and it may slow down overall browsing experience. |
FYI we now have a handy library for detecting IPFS urls and paths: is-ipfs. |
Let's revisit this 🌵🤔 Now that we have CID support in This means we don't need the list of "known public gateways" anymore and can redirect all
Given all of this I would appreciate some thoughts and ideas on:
|
Seems like pretty good news! Especially for those who want to maintain a public, but not wide public gateway.
I suppose that this behaviour is preferable for nearly all cases (except cases described in ipfs/notes#104). But list of known public gateways is still useful in some use-cases — at least for Copy public gateway URL function. It still necessary as long as there are those who not yet joined the distributed web! Maybe it's possible to add an option to select which public gateway to substitute in generated URL, if there are more than one in Preferences? For now it seems to be hardcoded on ipfs.io.
Definitely not (a). Of course, this is just a suggestion.
On this solution, final stage of checking will be delegated to the IPFS daemon, same as addon acts now with DNSLINK Support enabled? And "resolving DNS domain" means that it returns just generic Anyway, for now this solution seems to be enough in any of these cases, I think. |
Good ideas!
|
This commit removes false-positive redirects for paths that start with /ipns/{ipnsRoot} by following these steps: 1. is-ipfs test (may produce false-positives) 2. remove false-positives by checking if ipnsRoot is: - a valid CID (we check this first as its faster/cheaper) - or FQDN with a valid dnslin in DNS TXT record (expensive, but we reuse caching mechanism from dnslink experiment) This means we now _automagically_ detect valid IPFS resources on any website as long as path starts with /ipfs/ or /ipns/, removing problems described in #16 (comment) This commit also closes #69 -- initial load is suspended until dnslink is read via API, then it is cached so that all subsequent requests are very fast.
This commit removes false-positive redirects for paths that start with /ipns/{ipnsRoot} by following these steps: 1. is-ipfs test (may produce false-positives) 2. remove false-positives by checking if ipnsRoot is: - a valid CID (we check this first as its faster/cheaper) - or FQDN with a valid dnslin in DNS TXT record (expensive, but we reuse caching mechanism from dnslink experiment) This means we now _automagically_ detect valid IPFS resources on any website as long as path starts with /ipfs/ or /ipns/, removing problems described in #16 (comment) This commit also closes #69 -- initial load is suspended until dnslink is read via API, then it is cached so that all subsequent requests are very fast.
We are finally able to detect IPFS paths without obvious false-positives! 🎉 Latest version of our browser extension (v2.0.13) performs path validation on every request:
If a path starts with a valid IPFS-enabled root, then request is redirected to a local gateway. We also kinda-support custom protocols thanks to #289:
|
Summary of Open Ideas
/ipns/<fqdn>
)/ipns/
or/ipfs/
segment (risk of false-positives for IPNS namespace)TXT
DNS record and check if it containsdnslink
(no false-positives)Semi-related:
The text was updated successfully, but these errors were encountered: