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

feat: support page actions for CID subdomains #537

Merged
merged 1 commit into from
Jul 23, 2018
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Jul 23, 2018

@lidel lidel merged commit 9424acc into master Jul 23, 2018
@lidel lidel deleted the feat/subdomain-context branch July 23, 2018 20:27
lidel added a commit that referenced this pull request Nov 12, 2018
This is a fix of a regression for
#537
that was introduced when X-Ipfs-Path header support was added.

Until we are able to provide the same origin-based security guarantees
at a local gateway, we should not redirect resources that use
cid-in-subdomain deployment, as it is a strong hint they care about
Origin-based isolation and we should not relax those guarantees.
lidel added a commit that referenced this pull request Nov 12, 2018
This is a fix of a regression for
#537
that was introduced when X-Ipfs-Path header support was added.

Until we are able to provide the same origin-based security guarantees
at a local gateway, we should not redirect resources that use
cid-in-subdomain deployment, as it is a strong hint they care about
Origin-based isolation and we should not relax those guarantees.
Comment on lines +16 to +18
const fqdn = url.hostname.split('.')
const cid = fqdn[0]
const protocol = fqdn[1]
Copy link
Member Author

Choose a reason for hiding this comment

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

Just realized this won't produce correct results for gateways under multi-leveled domains such as cid.ipfs.something.co.uk.
Easy fix is to switch to is-ipfs, probably something like:

const { subdomainPattern } = require('is-ipfs')

const match = fqdn.match(subdomainPattern)
if (!match) throw new Error('no match for isIPFS.subdomainPattern')
const protocol = match[1]
const cid = match[2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant