Having issues connecting 2 golang servers over .internal network

I have an app that I intend to only be accessible from within my orgs private network. I have deployed a dead simple test server

func main() {
	http.HandleFunc("/pong", func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusOK)
		w.Write([]byte(`{ "message": "pong" }`))
	})
	http.ListenAndServe(":8080", nil)
}

with the following fly.toml

app = "private-api"

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

[experimental]
  allowed_public_ports = []
  auto_rollback = true

I have deployed a 2nd minimal app within my organization that simply tries to call the endpoint on the private server. I am fairly inexperienced on the networking side of things and have tried the following urls from within the calling app

"https://private-api.internal.fly.dev/pong", // -> no such host
"http://private-api.internal.fly.dev/pong", // -> no such host
"https://private-api.internal/pong", // -> connection refused
"http://private-api.internal/pong", // -> connection refused

It is my understanding that the default golang mux should be binding to both IPV4 and IPV6 and I am not quite sure what I am doing wrong. If I add a public server/endpoint to the fly.toml of the private-api server, then I can access it via the public url but still not via the .internal ones

I have also included the fly dig output below but I am not quite sure how to interpret it.

fly dig aaaa private-api.internal -a fly-private
;; opcode: QUERY, status: NOERROR, id: 9988
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;private-api.internal.	IN	 AAAA

;; ANSWER SECTION:
private-api.internal.	5	IN	AAAA	fdaa:0:4864:a7b:2203:1862:1c2d:2

Any help would be greatly appreciated

If your go app listens on port 8080, you’ll need to connect to port 8080 when using the internal network:

"http://private-api.internal:8080/pong"

Will you give that a try and see if it helps?

That was it. Thank you very much

1 Like