ipfs-webui
ipfs-webui copied to clipboard
Post request Failure with Nginx reverse proxy
I use Nginx as a reverse proxy for the IPFS API interface with the domain name api.mydomain.com, and it works well. However, the EXPLORE page(only) is not functioning properly. I have identified that the browser still use 127.0.0.1:5001 for POST requests in this page. How should I configure it to make the browser use https://api.mydomain.com/ for POST requests?
Here is my config about api
"Addresses": { "API": "/dns4/api.mydomain.com/tcp/5001", "Announce": [], "AppendAnnounce": [], "Gateway": [ "/dns4/gateway.mydomain.com/tcp/443", "/ip4/0.0.0.0/tcp/8080" ],
other page is normal
updated: I return the webui version to [v3.0.0],then the problem resolved XD (before is 4.1.1 latest)
@SgtPooki looks like there is a bug in the kubo-rpc-client migration, initial investigation makes me believe: https://github.com/ipfs/ipfs-webui/blob/v4.1.1/src/bundles/ipfs-provider.js#L389 should be:
loadHttpClientModule: () => create(apiAddress),
kubo-rpc-client expects: https://github.com/ipfs/js-kubo-rpc-client/tree/master#importing-the-module-and-usage and the ipfs-provider expects a promise: https://github.com/ipfs-shipyard/ipfs-provider/blob/4bde75366e79799c330c63a6c4ed96746402aca1/src/providers/http-client.js#L23
This might fix this, however this would require a setup like @akimoto72738 has to test.
@akimoto72738 you should be able to do localStorage.setItem('apiOpts', JSON.stringify({})) to configure your endpoint for the explore page.
However, this will be changing when I fix https://github.com/ipfs/ipfs-webui/issues/2176 shortly, and you'll need to do localStorage.setItem('kuboGateway', JSON.stringify({port: '1337'}))
https://github.com/ipfs/ipld-explorer-components/blob/edd95a4bd4c12fb55f0815ebbe18847f65f84823/src/bundles/helia.ts#L74
kubo-rpc-clientexpects: ipfs/js-kubo-rpc-client@master#importing-the-module-and-usage and theipfs-providerexpects a promise: ipfs-shipyard/ipfs-provider@4bde753/src/providers/http-client.js#L23
@whizzzkid I'm going to be getting rid of ipfs-provider since it's another one of those very old and unmaintained packages.
Yes, I felt so, ipfs-provider can prolly be deprecated.
Hi @SgtPooki , I have listed most of the fields in localStorage for your investigation, I dont know what value for apiOpts, I just copy and paste localStorage.setItem('apiOpts', JSON.stringify({})), is something url&port like value of IpfsApi ?
and here is my api setting in webui interface
@whizzzkid thanks If it's confirmed that this issue is a bug, you can @ me for testing after it's fixed. I usually keep my WebUI version as up-to-date as possible with your latest releases
@akimoto72738 you should be able to do
localStorage.setItem('apiOpts', JSON.stringify({}))to configure your endpoint for the explore page.However, this will be changing when I fix #2176 shortly, and you'll need to do
localStorage.setItem('kuboGateway', JSON.stringify({port: '1337'}))https://github.com/ipfs/ipld-explorer-components/blob/edd95a4bd4c12fb55f0815ebbe18847f65f84823/src/bundles/helia.ts#L74
@akimoto72738 currently, the apiOpts is for webui to talk to the Kubo RPC API, and kuboGateway is for talking to the kubo daemon as a trustless-gateway. You can set them both to unblock yourself, but I'll take your comments as a need to look into normalizing these fields again.
Ideally, we should be able to infer the kuboGateway from the apiOpts in ipfs-webui.
PS.. the latest ipfs-webui supports the kuboGateway now. In IPFS-Desktop, and webui.ipfs.io, and dev.webui.ipfs.io
One more thing. your original question was
How should I configure it to make the browser use api.mydomain.com for POST requests?
You should run the following in your browser console: localStorage.setItem('kuboGateway', JSON.stringify({port: '80', host: 'api.mydomain.com'}))
you should be able to verify the same functionality at explore.ipld.io (which is a web version of the explore page)