@carter is this Node.js or another runtime? Here’s some TypeScript from a node project doing this:
import { resolve6 } from "dns/promises";
async function getFlyInstances(): Promise<string[]> {
let address = `global.${process.env.FLY_APP_NAME}.internal`;
let ipv6s = await resolve6(address);
return ipv6s.map((ip) => `http://[${ip}]:8080`);
}
const instances = await getFlyInstances();
for (const instance of instances) {
const url = new URL(instance);
url.pathname = "/_refreshlocal";
url.search = search;
console.log(`forwarding post to ${url.toString()}`);
// we purposefully don't await, we're just notifying everybody
fetch(url.toString(), {
method: "POST",
headers: {
Authorization: process.env.AUTH_TOKEN!,
},
});
}
This grabs the internal IPv6 addresses, then sends an HTTP request to each of them in parallel.