Static IP for Fly.io
Every Machine in your Fly.io app can reach allowlisted APIs and databases from one stable IPv4, even as workloads scale or migrate.
First payment refunded within 7 days if it doesn’t work for you
- Partner API
- External DB
On this page12
On Fly.io, Anycast and dedicated IPv4 addresses only handle inbound traffic, while outbound calls leave from the shared worker host. Fly’s native static egress IPs are tied to individual Machines and cannot be shared with CI or external tools. Prontaro attaches one dedicated /32 to your whole app through an HTTPS proxy, a Relay URL, or a background prontaro forward process.
Which method to choose
| Fly.io workload | Prontaro method | Best for |
|---|---|---|
| Partner HTTPS APIs and payment gateways | PRONTARO_PROXY_URL (HTTPS proxy :443) |
End-to-end TLS and mTLS; no CLI needed in the image |
| Single REST API without proxy libraries | Relay URL (PRONTARO_RELAY_URL) |
Swap only the base URL in built-in fetch |
| External databases and TCP without SOCKS5 | Background process prontaro forward + PRONTARO_KEY |
Local 127.0.0.1:<port> listener inside the same Machine |
Prerequisites
- A Prontaro account on Dedicated (from $12/mo, 100 GB traffic) or Pro (plans).
- A dedicated IPv4 in the Prontaro location closest to your Fly.io region (available locations are shown in the dashboard).
- A Fly.io app and
flyctl(fly) installed locally.
Step 1. Create proxy credentials and allowlist your IP
Add your dedicated Prontaro IPv4 (/32) to the partner API or database allowlist, then create proxy credentials for Fly.io in the dashboard. Leave the To destination list open until you verify the outbound IP.
- Open IP addresses in my.prontaro.com and click Create proxy credentials.
- Name them
fly-prodand copy theHTTPSURL on port:443.
Step 2. Store the secret with fly secrets set
Save the proxy URL in Fly.io encrypted secrets:
fly secrets set PRONTARO_PROXY_URL="https://u_fly:s3cr3t@<entry>.prontaro.io:443"fly secrets set automatically triggers a rolling Machine restart. When setting multiple secrets at once (for example, alongside PARTNER_API_TOKEN), pass --stage and roll them out together on your next fly deploy.
Step 3. Send traffic through your static IP
Option A. HTTPS APIs with PRONTARO_PROXY_URL
Node.js 20+ example using undici (create ProxyAgent once at startup):
// src/partner.mjs
import { fetch, ProxyAgent } from 'undici';
const agent = new ProxyAgent({
uri: process.env.PRONTARO_PROXY_URL,
connections: 20,
});
export async function fetchPartnerStatus() {
const res = await fetch('https://api.example.com/v1/status', {
dispatcher: agent,
headers: { Authorization: `Bearer ${process.env.PARTNER_API_TOKEN}` },
signal: AbortSignal.timeout(15_000),
});
if (!res.ok) throw new Error(`Partner API error: ${res.status}`);
return res.json();
}See HTTP client examples for Python, Go, PHP, and Java snippets.
Option B. Background process prontaro forward with PRONTARO_KEY
Each Fly Machine runs a single container inside a lightweight VM. To reach an external database (PostgreSQL, MySQL, SFTP) with a driver lacking SOCKS5 support, bundle the static prontaro binary and run prontaro forward alongside your app.
-
Open the CLI tab in my.prontaro.com, issue a token named
fly-prod, and save it asPRONTARO_KEYin Fly.io (prontaro CLIreadsPRONTARO_KEYdirectly — noprontaro loginstep is required inside the container):fly secrets set PRONTARO_KEY="<token>" -
Install
prontaro(asroot,install.shplaces the binary directly in/usr/local/bin/prontaro) and add an entrypoint script in yourDockerfile:
FROM node:22-alpine
RUN apk add --no-cache ca-certificates curl netcat-openbsd \
&& curl -fsSL https://prontaro.com/install.sh | sh
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["node", "server.mjs"]- Start
prontaro forwardindocker-entrypoint.sh(with--no-inputto disable interactive prompts) and wait for127.0.0.1:15432before starting your app. On startup refusals (such as an unpaid or blocked account),prontaroexits immediately with a non-zero code instead of waiting, so the entrypoint exits1and Fly.io restarts the Machine according to its[[restart]]policy infly.toml(defaultpolicy = "on-failure"withretries = 10, orpolicy = "always"to keep retrying until the issue is resolved):
#!/bin/sh
set -eu
prontaro forward 15432 db.example.com:5432 --ip 203.0.113.10 --no-input --json &
FWD_PID=$!
trap 'kill "$FWD_PID" 2>/dev/null || true' INT TERM EXIT
for _ in $(seq 1 30); do
if nc -z 127.0.0.1 15432; then
break
fi
kill -0 "$FWD_PID" 2>/dev/null || break
sleep 0.5
done
if ! nc -z 127.0.0.1 15432; then
echo "prontaro forward did not become ready on 127.0.0.1:15432" >&2
exit 1
fi
exec "$@"Your app inside the Fly Machine connects to 127.0.0.1:15432, and the remote database sees your dedicated static IPv4.
Step 4. Verify the outbound IP
Run a check inside a running Fly Machine against api.ipify.org before tightening allowed destinations:
fly ssh console -C 'sh -c "curl -fsS --proxy \"$PRONTARO_PROXY_URL\" https://api.ipify.org"'
203.0.113.10Confirm the printed IP matches your dedicated IPv4 in my.prontaro.com.
Step 5. Lock down allowed destinations
After verifying the IP, restrict fly-prod to the exact partner hosts and ports:
- Open IP addresses → Proxy credentials in my.prontaro.com, select
fly-prod, switch to Access, and addapi.example.com:443under To. - Save.
Fly.io notes and limits
- Match regions: pick the Prontaro location in the dashboard closest to your Fly.io
primary_regionto minimize latency. - Horizontal scaling: all Machines share your IP’s concurrent connection limit (limits). Cap HTTP
connectionsand DB pool size per Machine so scale-outs stay within quota. - Explicit
--ipon Pro: with multiple dedicated IPs, always pass--ip <your-IP>toprontaro forwardbecause non-interactive Machines cannot answer an IP prompt. - BGP failover: on a server outage, your
/32moves to a standby Prontaro server without allowlist edits. Active TCP sessions close,prontaro forwardreconnects automatically, and new HTTP requests use the standby.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
407 Proxy Authentication Required |
Typo in the secret, or new credentials are still propagating (a few seconds). | Copy the exact URL under IP addresses, run fly secrets set, and retest. |
403 Forbidden from proxy |
Target host or port is missing from the To list. | Add <host>:443 to fly-prod destination rules in the dashboard. |
.internal or .flycast calls broke |
Global HTTPS_PROXY hijacked Fly 6PN traffic. |
Remove the global proxy or add .internal,.flycast to NO_PROXY. |
You have 2 addresses — choose which one |
Account has multiple IPs and prontaro forward has no --ip flag. |
Add --ip <your-IP> to docker-entrypoint.sh. |
Next steps
- Static IP and tunnels in Docker — container and Docker Compose patterns.
- PostgreSQL and AWS RDS with a static IP — TLS and driver setup for allowlisted databases.
- Local port forwarding (
prontaro forward) — background TCP forwarding options and flags. - HTTP & SOCKS5 proxy — proxy credentials, protocols, and allowed destination rules.
Related guides
- HTTP & SOCKS5 proxyRoute outbound HTTP, HTTPS, and TCP connections through your static IPv4 with one proxy credential set, end-to-end TLS, and From/To rules.
- Relay URLsCall IP-allowlisted HTTPS APIs from edge runtimes and no-code tools without proxy configuration by replacing the base URL with a Prontaro Relay URL.
- Local port forwarding (prontaro forward)Connect database drivers, SFTP clients, and CLI tools to remote servers from your static IPv4 over a local TCP port — no proxy support needed.
Something wrong on this page? Contact us