IPFS Webapp Detect Local Node

Hello!

I am building a webapp and would like to be able to connect to a local daemon if possible. However when trying to connect to localhost:5001 for the API I run into the CORS issue. Ideally I wouldn’t have to ask my users to change their IPFS daemon settings to allow CORS, does anyone know a way to modify the outgoing headers of the ipfs-http-client to change the origin or some other CORS solution?

Thanks!

So, there is no way of doing this without asking users to change their CORS settings on the daemon then.

Depends what you want to do. I think the gateway endpoint has CORS enabled by default, so you can make reads through that.

I’d like to provide the site’s visitor’s the option to pin the site to their node as a show of support, this is especially useful if they have a daemon that is always on (e.g. IPFS desktop). Plus the IPFS HTTP API is a much smaller package to provide when loading. Maybe I’m thinking about this wrong.

@lidel does IPFS companion permission-management help for this?

IPFS Companion would be perfect, but as far as I know the window.ipfs interface is still not functional as of now.