Why does a request to a proxied port hang?

I’m trying to setup an IPFS node, that runs an internal API at port 5001.

I’d like to talk to it on my laptop, so I tried to proxy it:

fly proxy 5001 -a rebase-ipfs

However, when I try to curl it locally, the request never completes:

curl localhost:5001
# ..... never finishes

IPFS is running at 5001

If I ssh into the VM:

fly ssh console -a rebase-ipfs

I can use telnet to run a simple request on port 5001:

# telnet 0.0.0.0:5001
Connected to 0.0.0.0:5001
POST /api/v0/id HTTP/1.0
Host: 0.0.0.0:5001

HTTP/1.0 200 OK
Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Content-Type: application/json
Server: go-ipfs/0.12.1
Trailer: X-Stream-Error
Vary: Origin
Date: Fri, 01 Apr 2022 18:48:57 GMT

# ... the body of the request

Fly.toml

app = "rebase-ipfs"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
image="ipfs/go-ipfs"

[mounts]
source="ipfs_data"
destination="/data/ipfs"

[env]
DATA="/data"
IPFS_PROFILE="server"

[[services]]
  internal_port = 4001
  protocol = "tcp"
  
  [[services.ports]]
    port = "4001"

[[services]]
  internal_port = 8080
  protocol = "tcp"
  
  [[services.ports]]
    port = "80"

  [[services.ports]]
    handlers = ["tls", "http"]
    port = "443"

What can I do to debug this further?

This happens when the process isn’t listening on IPv6. The fly proxy command connects over the private IPv6 address. I don’t know the exact config options for IPFS, but you might be able to make it listen on :: (all IPv6 and IPv4 addresses).

1 Like

Yup that was the correct answer. For future folks reading this, you can ssh into your fly instance:

fly ssh console --app your-app

And then change the config to listen on ipv6:

ipfs config Addresses.API --json "[\"/ip4/0.0.0.0/tcp/5001\", \"/ip6/::/tcp/5001\"]"
1 Like

I put up GitHub - ipfs-shipyard/go-ipfs-docker-examples as there is now an official way to inject config to go-ipfs when run in containers

1 Like