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

ipfs:// everywhere #93

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

ipfs:// everywhere #93

wants to merge 4 commits into from

Conversation

Gozala
Copy link

@Gozala Gozala commented Mar 29, 2021

No description provided.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with adding support for https://${gateway}/ipfs://${CIDv1} notation on gateways as a cheap way of improving UX, but it should be a convenience redirect to a URL following an existing path or subdomain convention:

https://${gateway}/ipfs://${CIDv1}
  → https://${gateway}/ipfs/${CIDv1}
    → https://${CIDv1}.ipfs.${gateway}

We can't make it a canonical notation because its not compatible with subdomain root requirement (details below)

Comment on lines +61 to +62
> Above examples from 2nd to 5th could redirect to:
> `ipfs://${originHash(CID)}.dweb.link/ipfs://${CIDv1}/`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No cigar. Subdomains are how we want people to load websites because content root is aligned with URL root.
Adding this artificial path prefix breaks that alignment and breaks relative paths on every website :(

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No cigar. Subdomains are how we want people to load websites because content root is aligned with URL root.

My understanding is we want to make sure that content is origin isolated based on CID. We can accomplish that without teaching people how to translate CIDs into origins etc... It is a lot easier to teach programs like gateways to do that, for humans we could just keep ipfs://${CIDv1}/ regardless of (sub)domain. That gives us:

  1. Origin base content separation we seek.
  2. We retain same path in form of ipfs://${CIDv1} across all gateways. Reinforcing that ${bridge} in ${bridge}ipfs://${CIDv1} is just a bridge to ipfs://${CIDv1}.

Adding this artificial path prefix breaks that alignment and breaks relative paths on every website :(

You mean sites that use /images/cat.png would be broken ? That is a fare point, although I think something that we can overcome by redirecting to /ipfs://{CIDv1}/images/cat.png based on referrer.

Also would not those sites be as broken when loaded from https://ipfs.io/ipfs/${CIDv1} now ?

Copy link
Member

@lidel lidel Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We spent years fixing bugs in various static website generators to support truly relative paths, and it remained a big adoption blocker because there was always a new bug for something new filled.

Only when subdomain gateways got introduced, and the CID root became the root of URL path, all websites and tools started working out-of-the-box with IPFS.

👉 Redirects are transparent in browser context, so your fix will work for a subset of problems like loading images or other assets, but it won't fix websites that execute JS code based on window.location.pathname 💔

Due to this I don't believe this is feasible (creates more problems than it solves).
The best we could do, is to start returning ipfs:// URIs in Link header: ipfs/in-web-browsers#179

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👉 Redirects are transparent in browser context, so your fix will work for a subset of problems like loading images or other assets, but it won't fix websites that execute JS code based on window.location.pathname 💔

That historical context is really helpful! Do you by a chance have a pointers to above JS problems, so it could be quantified and pros and cons could be evaluated.

I realize this is an unfortunate tradeoff. Then I also think that turning ipfs://{cid}/path/file into https:///${cid}.gateway.tld/path/file is a cause of why later form is more prominent. I also believe that later form makes it really difficult for an average person to realize that gateway could be swapped.

Maybe there is a compromise, that make better tradeoffs ?

proposals/normalize-addressing.md Show resolved Hide resolved
@Gozala
Copy link
Author

Gozala commented Mar 30, 2021

I am ok with adding support for https://${gateway}/ipfs://${CIDv1} notation on gateways as a cheap way of improving UX, but it should be a convenience redirect to a URL following an existing path or subdomain convention:

https://${gateway}/ipfs://${CIDv1}
  → https://${gateway}/ipfs/${CIDv1}
    → https://${CIDv1}.ipfs.${gateway}

We can't make it a canonical notation because its not compatible with subdomain root requirement (details below)

What I was suggesting here it should do following instead:

https://${gateway}/ipfs://${CIDv1}
 → https://${CIDv1}.ipfs.${gateway}/ipfs://${CIDv1}

The whole point here is that domain stuff, is for programs like browsers to do a the right thing and should be meaningless for humans. As for humans they can ignore that stuff in domain and always see ipfs://${CIDv1} making the whole pattern recognition work.

@mikeal mikeal added the Nitro NFT Free for All label Mar 30, 2021
@Gozala Gozala changed the title propose normalizing addressing ipfs:// everywhere Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Nitro NFT Free for All
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants