I have two http apps that I want to be able to communicate via the private network :
front
api
The .internal address of api is properly resolved in the front service (ping ok), but I have a connection refused if I try to curl api directly on its listening port.
I also tried deploying api with the [http_service] section to publicly expose ports 80 and 443 but I also get a connection refused on those ports when curling the .internal address from the front service.
Both apps are deployed in the same region within the same organization
API is bound to 0.0.0.0:3000
Does someone have an idea on how to debug/fix this ?
Requests to .internal addresses go straight to the target machine, not through the reverse proxy. You’ll want to send requests to the internal_port for the target service instead of the public HTTP/HTTPS port.
# fly ssh console -a front
# apk add curl
# curl -v api.internal:3000
* Trying [fdaa:0:****:***:****:****:****:*]:3000...
* connect to fdaa:0:****:***:****:****:****:* port 3000 failed: Connection refused
* Failed to connect to api.internal port 3000 after 1 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to api.internal port 3000 after 1 ms: Couldn't connect to server
The API service is properly listening
# fly ssh console -a api
# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 303/next-router-wor
tcp 0 0 fdaa:0:****:***:****:****:****:*:22 :::* LISTEN 304/hallpass
# apk add curl
# curl localhost:3000/health
{"status":"success"}