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

gateway api doesn't resolve ipns entries #1586

Closed
krl opened this issue Aug 16, 2015 · 12 comments
Closed

gateway api doesn't resolve ipns entries #1586

krl opened this issue Aug 16, 2015 · 12 comments
Labels
kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway

Comments

@krl
Copy link
Contributor

krl commented Aug 16, 2015

@rht

krl@bataille:~$ curl "http://gateway.ipfs.io/api/v0/object/get?arg=%2Fipns%2FQmPY8N2qYSV6qBtpPZ6Kfuj9H35gLmytEySbGj2zFyCPQs&stream-channels=true"
{
  "Message": "could not resolve name.",
  "Code": 0
}

krl@bataille:~$ curl "http:/localhost:5001/api/v0/object/get?arg=%2Fipns%2FQmPY8N2qYSV6qBtpPZ6Kfuj9H35gLmytEySbGj2zFyCPQs&stream-channels=true"
{
  "Links": [
    {
      "Name": "log",
      "Hash": "QmVzy8nvhYdxPE9EDvaSgnsErQ4CvNjyvGtDbQNyMf73Lt",
      "Size": 1219
    }
  ],
  "Data": "{\"type\":\"starlog-feed\",\"name\":\"frong\"}"
}
@rht
Copy link
Contributor

rht commented Aug 16, 2015

can't reproduce. likely due to caching

@krl
Copy link
Contributor Author

krl commented Aug 21, 2015

@rht, @lgierth - i made this test script to show what i want to work:

http://gateway.ipfs.io/ipfs/QmZmgC5Cw1scmQwUZp9X7QZBPFyPrXt1Uz1hXYSTeV1tL1/

it works fine on localhost, but fails on gateway. Probably something to do with the Referer. Thoughts?

@ghost
Copy link

ghost commented Aug 21, 2015

@rht
Copy link
Contributor

rht commented Aug 21, 2015

Most likely.

Because it works if directly from the gateway http://gateway.ipfs.io/api/v0/cat?arg=/ipfs/QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V

The script doesn't tell if the err is 403 or 404, however.

@ghost
Copy link

ghost commented Aug 21, 2015

And the related tokens/CORS discussion: #1532

@ghost
Copy link

ghost commented Aug 21, 2015

The script doesn't tell if the err is 403 or 404, however.

It does in the network console, it's all 403 with a "403 - Forbidden" body

@jbenet
Copy link
Member

jbenet commented Aug 21, 2015

@lgierth does the gateway have the CORS headers setup?

  • do we want to allow "*"? (i'd say lets wait until we know we have to)
  • let's allow "gateway.ipfs.io" and "ipfs.io" for now?

@krl
Copy link
Contributor Author

krl commented Aug 22, 2015

Setting the gateway CORS to its own domain should be enough, other gateways will choose their own CORS.

Assuming most people would not need to send cookies with their gateways, we could just warn them that it's not an opaque thing no?

@krl
Copy link
Contributor Author

krl commented Aug 24, 2015

@lgierth any progress/ETA on this?

@ghost
Copy link

ghost commented Aug 24, 2015

on it right now

@jbenet
Copy link
Member

jbenet commented Aug 24, 2015

16:13 <•jbenet> https://github.com/ipfs/go-ipfs/blob/master/commands/http/handler.go#L94 <--- api handler. not 100% certain it's getting the right values for the _readable gateway_
16:14 <•jbenet> it may just be pulling the same cors as API, which is bad, we want it to pull the CORS of the "gateway".
16:15 <•jbenet> (its confusing to call these "gateway" and "api" still, because both now have "gateway" and "api" parts to them
16:16  ⇐ voxelot quit  ↔ danslo nipped out  
16:18 <•jbenet> maybe we can call them "internal http server" and the "external http server" 

so at the very least, it looks like

  • the "API" part of the "external" server needs to adopt different CORS set than regular "internal" API, else problems will emerge
  • the "API" part of the "external" server should be currently pulling the same CORS as API.HTTPHeaders (but i'm not sure if im reading code correctly)

maybe:

  • rename the "8080" server to "External Gateway" or "External API" or "External Server"
  • rename the "5001" server to "Internal Gateway" or "Internal API" or "Internal Server"
  • (i dont like the word "Server". anything similar?)
  • if we rename, will need to migrate config values + docs.

@ghost ghost added kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway labels Aug 24, 2015
@jbenet jbenet assigned ghost Aug 24, 2015
@jbenet jbenet added the status/in-progress In progress label Aug 24, 2015
@krl
Copy link
Contributor Author

krl commented Aug 26, 2015

All good!

@krl krl closed this as completed Aug 26, 2015
@jbenet jbenet removed the status/in-progress In progress label Aug 26, 2015
@ghost ghost mentioned this issue Aug 26, 2015
56 tasks
@ajnavarro ajnavarro mentioned this issue Aug 24, 2022
72 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway
Projects
None yet
Development

No branches or pull requests

3 participants