How do I make a request to a Fly Machine in a private Fly App (custom 6PN) over the Wireguard VPN?

I have a Fly App on a private network. I’ve attached a Flycast private IPv6 address to the app with

fly ips allocate-v6 -a a41fbf70-e3cc-4436-a767-a6aadfe8ce45 --private

The app’s IP is fdaa:9:7823:0:1::8 .
The machine’s IP is fdaa:c:ba99:a7b:8a:f84b:d429:2 .

How do I make a request to the machine over the Wireguard VPN?

I already tried:

curl --request POST http://[fdaa:9:7823:0:1::7]:65432

But I get:

curl: (56) Recv failure: Connection reset by peer

Hi… The fdaa:9:7823:* prefix matches your default network from earlier, so that looks ok. What does fly services list -a a41fbf70-e3cc-4436-a767-a6aadfe8ce45 show, at the moment?

Flycast is a function of the Fly Proxy, :proxy_robin:; if you’re creating things with the Machines API, you will consequently need to specify internal_port, the corresponding ports array, and (typically) at least one protocol handler.


Aside: It might also be wise to revisit the netstat test from the other thread just to make sure that you’re listening on IPv4. (Flycast is different from the .internal addresses in many respects.)

It’s listening on both ipv4 and ipv6:

netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp6 0 0 :::65432 :::* LISTEN
tcp6 0 0 fdaa:c:c4ea:a7b:1aa::22 :::* LISTEN
tcp6 0 268 fdaa:c:c4ea:a7b:1aa::22 fdaa:c:c4ea:a7b:1:22808 ESTABLISHED
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 7152 /.fly/api
unix 2 [ ACC ] STREAM LISTENING 7165 /tmp/dotnet-diagnostic-322-76-socket
unix 3 STREAM CONNECTED 7130
unix 3 STREAM CONNECTED 7129

/app $ curl -X POST http://127.0.0.1:65432/execute
REDACTED RESPONSE

/app $ curl -X POST http://[::1]:65432/execute
REDACTED RESPONSE

This is the JSON I used to set the machine up:

{
“name” : “d69c6043-84c4-4953-94a5-bade92f6b3d4”,
“config” : {
“image” : “REDACTED”,
“env” : {
“APP_ENV” : “production”
},
“services” : [ {
“port” : 65432,
“autostop” : “off”,
“autostart” : true
} ],
“auto_destroy” : false
}
}

When I run fly services, I don’t seem to get anything back other than the column names, even though the machine is running:

fly services list -a afa0ac6e-6a60-44da-946f-0d1bbbe267ea
Services
PROTOCOL PORTS HANDLERS FORCE HTTPS PROCESS GROUP REGIONS MACHINES

Here is what one of my own Flycast apps has:

PROTOCOL  PORTS       HANDLERS  FORCE HTTPS
TCP       80 => 8080  [HTTP]    False

(A few fields elided.)

In this case, curl would contact port 80, whereas the Machine itself is listening on port 8080.

Try changing port to internal_port and then adding a "ports": [{...}] array, along the lines of the docs example.

(You would leave off SSL for Flycast, of course.)

This is a two-sided configuration, and you’re missing one (or maybe even both) of the sides.

Hope this helps!

Changing port → internal_port and adding

“ports” : [ {
“port” : 65432
} ]

seems to have made things work. Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.