jessie
December 6, 2022, 1:53am
1
I created an App which contains two different Machine VMs; the VMs are running different Docker images.
After creating a new machine using flyctl, I was given a private ip:
Machine started, you can connect via the following private ip fdaa:0:f205:a7b:a45b:4f67:ccf4:2
How can I hit that particular instance of the VM directly from the public internet?
On way is using (userspace) wireguard proxy which is accessible with the flyctl proxy
command: wireguard tunnels from userland - #2 by kurt
Ref this example from docs on connecting to MinIO’s web-ui over (6pn
) private IP with flyctl proxy
: Deploy MinIO Object Storage to Fly.io · Fly Docs
Read also: WireGuard peering without proxy - #2 by kurt
I am facing the same problem here trying to proxy all requests through a new machine private_ip but i get ENOTFOUND on the ip:
app.use(async (req, res, next) => {
try {
const { ip, id } = await newMachine();
const proxyMiddleware = createProxyMiddleware({
target: `http://${ip}:80`,
changeOrigin: true,
onError: async (err, req, res) => {
console.error("An error occurred while proxying the request:", err);
await killMachine(id);
res.status(500).json({
message: "An error occurred while proxying the request.",
error: err,
});
},
onProxyRes: async (proxyRes, req, res) => {
await killMachine(id);
console.log(`Request to ${req.url} was successfully proxied.`);
},
});
proxyMiddleware(req, res, next);
} catch (error) {
console.error("Error creating a new machine:", error.message);
res.status(500).json({ message: "Error creating a new machine.", error });
}
});
system
Closed
May 4, 2024, 1:08am
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.