For testing, I execute this request curl -v -X POST https://ipfs.infura.io/ipfs/, but it returns a 405 code:
> POST /ipfs/ HTTP/1.1
> Host: ipfs.infura.io
> User-Agent: curl/7.60.0
> Accept: */*
>
< HTTP/1.1 405 Method Not Allowed
< Date: Sat, 30 Mar 2019 18:09:44 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 41
< Connection: keep-alive
< Server: nginx
<
* Connection #0 to host ipfs.infura.io left intact
Method POST not allowed: read only access
This response can be confusing because it says that we can’t POST any request. Should Infura allow this type of requests? Or maybe redirect it to :5001/api/v0/add… I don’t know, some explanation?
yeah @mike, but seems that the standard method to check writable gateways is send a POST request to the gateway (for example https://gateway.name/ipfs/), and if the response is ok, then the node is writable, otherwise, the gateway is not writable.
This is the same behavior for all public IPFS gateways except Infura, that is writable through the API but it doesn’t allow POST request to gateway…
Should Infura change this?? Do you know what I mean?
This seems like undocumented behavior. Have you found a reference to that behavior in the IPFS API specification? Just to make sure I understand your use case, are you trying to determine which public endpoints allow you to pin content to their node by making a POST request to the IPFS gateway endpoint?
Yes, I want to show public gateways that allow add content. For that purpose, I make a POST request, and gateways that return a 2xx response are writable, otherwise not. Note that these writable gateways do not have to have public the API from the 5001 port (/api/v0/add). For example, https://hardbin.com/ipfs/ don’t expose the API but I can add content:
Sorry, now I understand what you’re referring to. We’ve never enabled the writeable gateway option on our endpoint and would need to take a look at it to determine if its feasible for us to support it right now. I’ve logged it as a feature request with our team but it won’t be something we’d be supporting in the near term. Is there a reason you prefer to use the writeable gateway instead of the api add option?
The only reason to use the writable gateway option is to check if the gateway is writable. Check the service that I developed to view the public IPFS gateways state. Writable gateways are shown in green (W column), but Infura doesn’t. @egalano thanks for the fast responses.