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

Post request Failure with Nginx reverse proxy #2178

Open
akimoto72738 opened this issue Nov 27, 2023 · 7 comments
Open

Post request Failure with Nginx reverse proxy #2178

akimoto72738 opened this issue Nov 27, 2023 · 7 comments
Labels
area/screen/peers Issues related to Peers screen effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers kind/bug A bug in existing code (including security flaws) status/ready Ready to be worked

Comments

@akimoto72738
Copy link

akimoto72738 commented Nov 27, 2023

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?

image

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
image

updated:
I return the webui version to [v3.0.0],then the problem resolved XD (before is 4.1.1 latest)

@akimoto72738 akimoto72738 added the need/triage Needs initial labeling and prioritization label Nov 27, 2023
@github-project-automation github-project-automation bot moved this to Needs Grooming in IPFS-GUI (PL EngRes) Nov 27, 2023
@whizzzkid
Copy link
Contributor

@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.

@whizzzkid whizzzkid added kind/bug A bug in existing code (including security flaws) status/ready Ready to be worked exp/beginner Can be confidently tackled by newcomers effort/hours Estimated to take one or several hours area/screen/peers Issues related to Peers screen and removed need/triage Needs initial labeling and prioritization labels Nov 30, 2023
@SgtPooki
Copy link
Member

@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

@SgtPooki
Copy link
Member

kubo-rpc-client expects: ipfs/js-kubo-rpc-client@master#importing-the-module-and-usage and the ipfs-provider expects 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.

@whizzzkid
Copy link
Contributor

Yes, I felt so, ipfs-provider can prolly be deprecated.

@akimoto72738
Copy link
Author

akimoto72738 commented Dec 1, 2023

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 ?

image
image

and here is my api setting in webui interface

image

@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

@SgtPooki
Copy link
Member

SgtPooki commented Dec 6, 2023

@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

@SgtPooki
Copy link
Member

SgtPooki commented Dec 6, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/screen/peers Issues related to Peers screen effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers kind/bug A bug in existing code (including security flaws) status/ready Ready to be worked
Projects
No open projects
Status: Needs Grooming
Development

No branches or pull requests

3 participants