Static IP for Cloudflare Workers
Call IP-allowlisted APIs directly from Cloudflare Workers with built-in fetch() — no npm dependencies and no proxy client required.
First payment refunded within 7 days if it doesn’t work for you
- Partner API
On this page9
Cloudflare Workers run in V8 isolates across rotating Cloudflare IP ranges and cannot use traditional ProxyAgent or HTTP_PROXY libraries over direct TCP sockets. Instead, you bind a personal Relay URL (https://relay-<uuid>.prontaro.run) to the partner API host, store it with wrangler secret put, and let Prontaro forward each request from your dedicated static IPv4.
Why Relay URL is the right fit
| Approach in Cloudflare Workers | Works with built-in fetch() |
npm dependencies | Outbound IPv4 |
|---|---|---|---|
Direct fetch() |
Yes | None | Rotating Cloudflare pool |
| HTTP CONNECT proxy | No (no ProxyAgent over direct TCP sockets) |
— | — |
| Prontaro Relay URL | Yes | None | Your dedicated /32 |
Prerequisites
- A Prontaro account on Dedicated (from $12/mo, 100 GB traffic) or Pro (plans) with a dedicated IPv4.
- A Cloudflare Workers project with
wrangler(npx wrangler).
Step 1. Create a Relay URL and enable Prontaro-Relay-Auth
Add your dedicated IPv4 (/32) to the partner API allowlist, then create a Relay URL bound to the partner host and protect it with a login and password.
The Prontaro server verifies and strips the Prontaro-Relay-Auth header before forwarding the request, so your upstream Authorization: Bearer ... header reaches the partner API untouched.
- Open IP addresses in my.prontaro.com and click Add relay address.
- Enter the target host
api.example.comand copy the generatedhttps://relay-....prontaro.runURL. - Open the Relay’s Access tab, add a password named
cf-worker, and copy theProntaro-Relay-Authvalue (<login>:<password>).
Step 2. Save secrets with wrangler secret put
Store the Relay URL, Prontaro-Relay-Auth credentials, and partner API token as encrypted Worker secrets:
npx wrangler secret put PRONTARO_RELAY_URL
# Paste: https://relay-3f9c2a7e-5b1d-4c8a-9e60-1d2b3c4d5e6f.prontaro.run
npx wrangler secret put PRONTARO_RELAY_AUTH
# Paste: cf-worker:s3cr3tPass
npx wrangler secret put PARTNER_API_TOKEN
# Paste: tok_partner_exampleYou can also set the same secrets in the Cloudflare dashboard:
- PRONTARO_RELAY_URL
- https://relay-3f9c2a7e-5b1d-4c8a-9e60-1d2b3c4d5e6f.prontaro.run
- PRONTARO_RELAY_AUTH
- cf-worker:s3cr3tPass
- PARTNER_API_TOKEN
- tok_partner_example
For local testing with npx wrangler dev, add these three variables to .dev.vars in KEY=value format (and keep .dev.vars in .gitignore).
Step 3. Call the API with standard fetch()
Zero npm packages required — construct new URL(path, env.PRONTARO_RELAY_URL) and send both headers:
// src/index.ts
export interface Env {
PRONTARO_RELAY_URL: string;
PRONTARO_RELAY_AUTH: string;
PARTNER_API_TOKEN: string;
}
export default {
async fetch(request: Request, env: Env): Promise<Response> {
if (!env.PRONTARO_RELAY_URL || !env.PRONTARO_RELAY_AUTH) {
return Response.json(
{ error: 'PRONTARO_RELAY_URL and PRONTARO_RELAY_AUTH are required' },
{ status: 500 },
);
}
// Path and query string are forwarded to https://api.example.com unchanged
const upstreamUrl = new URL('/v1/status?env=prod', env.PRONTARO_RELAY_URL);
const upstream = await fetch(upstreamUrl, {
method: request.method === 'POST' ? 'POST' : 'GET',
headers: {
// Verified and stripped by the Prontaro server before forwarding
'Prontaro-Relay-Auth': env.PRONTARO_RELAY_AUTH,
// Reaches api.example.com untouched
Authorization: `Bearer ${env.PARTNER_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: request.method === 'POST' ? await request.text() : undefined,
signal: AbortSignal.timeout(15_000),
});
return new Response(upstream.body, {
status: upstream.status,
headers: {
'content-type': upstream.headers.get('content-type') ?? 'application/json',
},
});
},
};Deploy the Worker:
npx wrangler deployStep 4. Verify the outbound IP
To verify your Cloudflare Worker exits from your dedicated static IPv4, create a temporary Relay for api.ipify.org, call it from your Worker, and remove it right after:
- Open IP addresses in my.prontaro.com and click Add relay address.
- Enter the target host
api.ipify.organd copy the generated temporaryhttps://relay-....prontaro.runURL.
Call new URL('/?format=json', relayIpifyUrl) from a temporary check route and invoke your deployed Worker:
curl -fsS https://your-worker.your-subdomain.workers.dev/egress-check
{"ip":"203.0.113.10"}Confirm the address matches your dedicated IPv4 in my.prontaro.com, then delete the temporary Relay:
- Open IP addresses, find the temporary Relay for
api.ipify.org, and click Delete.
Cloudflare Workers notes and limits
- Enable Smart Placement for lower latency: add
[placement] mode = "smart"inwrangler.tomlso Cloudflare runs your Worker closer to your Prontaro IP location and target API. - One Relay per target host (
https://...:443): if your Worker talks to two partner domains, create two Relay URLs and store them in separate secrets (PRONTARO_RELAY_PAYMENTS,PRONTARO_RELAY_CRM). - HTTP/1.1 only: WebSockets and
Upgraderequests are not supported over Relay URLs. - Fast rotation if leaked: add a new password login and delete the old one in the Relay’s Access tab, or delete and recreate the Relay under IP addresses, then update the secret with
wrangler secret put.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
401 or 407 from Relay |
Missing Prontaro-Relay-Auth header or trailing whitespace in the secret. |
Store PRONTARO_RELAY_AUTH as login:password using wrangler secret put. |
Partner API returns 401 Unauthorized |
Used HTTP Basic in Authorization instead of Prontaro-Relay-Auth, overwriting the partner token. |
Send Relay credentials in Prontaro-Relay-Auth and keep the partner token in Authorization. |
| Cross-host redirect disappeared | Relay strips the Location header pointing to another domain and adds Prontaro-Relay-Notice. |
Point your Relay at the final API host, or create a separate Relay for the second domain. |
Secret is undefined in wrangler dev |
wrangler secret put only populates deployed Workers. |
Put local development values in .dev.vars at the project root. |
Next steps
- Relay URLs — how Relay URLs work, password protection, and limits.
- Static IP for Vercel — static IP setup for Vercel Functions and Edge Runtime.
- Static IP for Supabase — outbound calls from Edge Functions and access to locked-down Postgres.
- Reliability, zero-downtime updates, and BGP failover — how your
/32stays intact during BGP failover.
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