Skip to content
Fixedmark

Platforms · 11 min read

Updated

Edge Runtimes and Outbound Proxies: What Works

Edge runtimes give you the web-standard `fetch`, which has no proxy, agent, or dispatcher option, so a Cloudflare Worker or a Vercel Edge Function cannot send a request through an HTTP CONNECT proxy. Deno-based runtimes are the exception, through `Deno.createHttpClient`. Everywhere else, move the allowlisted call to a regional function or a small relay that uses the proxy.

On this page

Why edge fetch has no proxy setting

On Node.js, a proxy belongs to the HTTP client, not to the request. undici takes a dispatcher. The older https module takes an agent. Libraries such as https-proxy-agent open the TCP socket to the proxy themselves, send CONNECT, and hand the tunnel to the TLS layer. All of that needs raw sockets and a TLS stack your code controls.

Edge runtimes give you the web-standard fetch instead. The standard RequestInit covers method, headers, body, cache, credentials, redirect, signal, and a few more fields. MDN's list has nothing for a proxy or an agent. In a browser, the browser or the operating system decides about proxies, never the page. Edge runtimes kept that model. The platform owns the network path, and subrequests leave from the platform's own addresses.

Node.js compatibility layers do not change this. In Workers, the node:http client is a wrapper around the global fetch. Its Agent is a stub without pooling or keep-alive, and request options such as createConnection are unsupported. A proxy agent has nowhere to plug in. Vercel's Edge runtime offers web APIs plus five Node.js modules (async_hooks, events, buffer, assert, and util). There is no net and no tls.

So the request does not fail. It succeeds from a shared address that moves between data centers, which a partner's IP allowlist rejects. Why serverless egress IPs change covers that half of the problem. This post covers what you can do about it from edge code.

What each edge runtime allows today

Proxy support and fixed egress on edge runtimes, November 2026
RuntimeProxy on fetchNative fixed egressNotes
Cloudflare WorkersNoDedicated CDN Egress IPs, Enterprise onlyRaw TCP through connect(), with one startTls() per socket
Vercel Edge runtimeNoStatic IPs (Pro and Enterprise) for Vercel Functions. Routing Middleware never uses themVercel recommends moving from edge to Node.js
Netlify Edge FunctionsDeno.createHttpClient, reported working, not documentedNone. Private Connectivity excludes Edge FunctionsRuns on Deno
Supabase Edge FunctionsDeno.createHttpClientNoneRuns on Deno
Deno DeployDeno.createHttpClient in the standard runtimeNone documentedDeploy Classic lacked it and was scheduled to shut down on July 20, 2026

Vercel has mostly settled the question for Next.js. Its Edge runtime page now says it recommends migrating from edge to Node.js, and that from Next.js 16.3, setting runtime = 'edge' is no longer supported. Routes run on Node.js, where undici's ProxyAgent works.

Netlify is a moving target. In a Netlify support forum thread, a user reported in January 2026 that Deno.createHttpClient worked in the Netlify CLI but threw Deno.createHttpClient is not a function in production. Netlify staff reported a fix on July 31, 2026, and the user confirmed it in production a week later. Netlify's own docs do not describe it, so treat it as something to test, not a platform promise.

Deno Deploy changed under the same question. Deploy Classic exposed only stable APIs and listed Deno.createHttpClient under future support. Deno scheduled Classic to shut down on July 20, 2026. The current Deno Deploy runtime is the standard Deno runtime (2.5.0 at the time of writing), run with --allow-all, and Deno says it supports every feature of the Deno CLI.

What Workers connect() makes possible

Workers have one way around the fetch limit, TCP sockets. connect() from cloudflare:sockets opens a socket to a host and port. Its secureTransport option is off, on, or starttls. With starttls, the socket starts in plain text and you upgrade it later with startTls(). Cloudflare's docs say startTls() works only on a socket created with starttls, and should be called only once.

That single upgrade decides which proxies fit. A tunnel to an HTTPS destination goes in a fixed order. You send CONNECT host:443 to the proxy, wait for 200, and then run TLS with the destination inside the tunnel. The CONNECT walk-through shows the bytes.

  • A plain CONNECT proxy, then TLS to the destination. One upgrade, so it fits.
  • A plain SOCKS5 proxy, then TLS to the destination. Same shape, so it fits.
  • An https:// proxy URL. That is TLS to the proxy, then a second TLS session to the destination inside the first. Workers cannot nest TLS, so it does not fit. HTTPS proxy endpoints explains why that design exists.
  • SOCKS5 over TLS. Same problem as the https:// proxy.

The Worker below does the plain CONNECT handshake by hand. We ran it in wrangler dev (Wrangler 4.59) against a local CONNECT proxy with Basic auth, and it fetched https://fixedmark.com/api/ip through the tunnel. A wrong password came back as the proxy's 407 line. Read it as a demonstration of the mechanism, not a client to ship.

src/index.ts
import { connect } from "cloudflare:sockets";

interface Env {
  PROXY_HOST: string; // a plain CONNECT port, not a TLS one
  PROXY_PORT: string;
  PROXY_USER: string;
  PROXY_PASS: string;
}

const enc = new TextEncoder();
const dec = new TextDecoder();

// Read until the blank line that ends the proxy's reply headers.
async function readHead(reader: ReadableStreamDefaultReader<Uint8Array>) {
  let head = "";
  while (!head.includes("\r\n\r\n")) {
    const { value, done } = await reader.read();
    if (done) throw new Error("proxy closed the connection");
    head += dec.decode(value, { stream: true });
    if (head.length > 8192) throw new Error("proxy reply too large");
  }
  return head;
}

async function getViaConnect(env: Env, host: string, path: string) {
  // 1. Plain TCP to the proxy, with permission to upgrade once.
  const socket = connect(
    { hostname: env.PROXY_HOST, port: Number(env.PROXY_PORT) },
    { secureTransport: "starttls", allowHalfOpen: false },
  );
  const writer = socket.writable.getWriter();
  const reader = socket.readable.getReader();

  // 2. Ask for a tunnel. These bytes, credentials included,
  //    cross the network unencrypted.
  const auth = btoa(`${env.PROXY_USER}:${env.PROXY_PASS}`);
  await writer.write(
    enc.encode(
      `CONNECT ${host}:443 HTTP/1.1\r\nHost: ${host}:443\r\n` +
        `Proxy-Authorization: Basic ${auth}\r\n\r\n`,
    ),
  );
  const head = await readHead(reader);
  if (head.split(" ")[1] !== "200") {
    await socket.close();
    throw new Error(`proxy refused: ${head.split("\r\n")[0]}`);
  }
  writer.releaseLock();
  reader.releaseLock();

  // 3. TLS with the destination, inside the tunnel. Name the real
  //    host, or the handshake uses the proxy's name.
  const tls = socket.startTls({ expectedServerHostname: host });

  // 4. From here you write HTTP/1.1 yourself.
  const w = tls.writable.getWriter();
  await w.write(
    enc.encode(
      `GET ${path} HTTP/1.1\r\nHost: ${host}\r\n` +
        "Accept: */*\r\nConnection: close\r\n\r\n",
    ),
  );
  w.releaseLock();
  // Raw status line, headers, and body. No parsing, no dechunking.
  return new Response(tls.readable).text();
}

export default {
  async fetch(_req: Request, env: Env): Promise<Response> {
    const raw = await getViaConnect(env, "fixedmark.com", "/api/ip");
    return new Response(raw, { headers: { "content-type": "text/plain" } });
  },
} satisfies ExportedHandler<Env>;

One line matters more than it looks. startTls() accepts an expectedServerHostname option, which appears in the TlsOptions type in @cloudflare/workers-types. The socket was opened to the proxy, so without that option the handshake is made in the proxy's name. In our test, leaving it out made the destination reject the TLS handshake outright. Always pass the destination host.

The cost of speaking HTTP over a raw socket

The sample works, but it gives up most of what fetch does for you. Count the costs before you build on it.

  • Proxy credentials travel in cleartext. Basic auth is base64, not encryption, so anyone on the path between Cloudflare and the proxy can read the token. Scope it to the hosts it needs and plan for rotating proxy credentials.
  • You own HTTP/1.1. Redirects, chunked transfer encoding, compression, and HTTP/2 are all yours to handle. The sample returns raw bytes because a correct parser is longer than the rest of the file.
  • Nothing is reused. Cloudflare's docs say TCP sockets cannot be created in global scope and shared across requests. Every invocation pays a TCP handshake to the proxy, the CONNECT round trip, and a full TLS handshake with the destination.
  • Each open socket counts toward the Workers limit on simultaneous open connections.
  • connect() cannot reach Cloudflare IP ranges. A proxy that sits behind Cloudflare is unreachable this way, and the error is proxy request failed, cannot connect to the specified address.
  • It does not combine with Cloudflare's own fixed egress. Per Cloudflare's docs, Dedicated CDN Egress IPs are not used for connect() sockets.

A single low-volume call to a proxy you run yourself can live with these costs. Payment, payout, and broker order traffic should not. A relay is easier to secure, to log, and to debug.

The relay pattern

A relay moves the allowlisted call to a runtime that has a normal HTTP client. The Worker calls the relay over fetch. The relay calls the partner through the static IP proxy. The partner only ever sees the proxy's addresses.

  1. Deploy a small service on a container or regional function platform, such as Railway, Fly.io, Cloud Run, or a Vercel function on the Node.js runtime.
  2. Give the relay the proxy URL, the partner's API key, and a long random shared secret.
  3. Give the Worker the relay URL as a variable and the secret with npx wrangler secret put RELAY_SECRET.
  4. Check the relay's egress IP through the proxy, then send that address to the partner for their allowlist.
interface Env {
  RELAY_URL: string;
  RELAY_SECRET: string;
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const res = await fetch(`${env.RELAY_URL}/v1/orders`, {
      method: "POST",
      headers: {
        authorization: `Bearer ${env.RELAY_SECRET}`,
        "content-type": "application/json",
      },
      body: await request.text(),
    });
    return new Response(res.body, {
      status: res.status,
      headers: {
        "content-type": res.headers.get("content-type") ?? "application/json",
      },
    });
  },
} satisfies ExportedHandler<Env>;

We ran the relay on Node.js 26 with undici 8 against a local CONNECT proxy. It forwarded the body, answered 401 to a wrong secret, and 404 to any other path. Undici 8 needs Node.js 22.19 or later. On older Node.js, install undici@7.

Rules that keep a relay safe

  • Never forward a destination taken from the request. A relay that accepts a target URL is an open proxy on an address your partners trust.
  • Check the secret in constant time, and reject before you read the body.
  • Keep the partner's API key in the relay. A leaked Worker secret then reaches only the fixed paths the relay allows.
  • Put the relay near the partner, not near your users. For an Indian bank or broker API, that means a Mumbai region. The edge-to-relay hop is the price of the pattern. The relay-to-partner hop is usually the one that needs to be short.
  • Set timeouts on both hops, and log the upstream status without logging request bodies.

Proxying fetch on Deno-based runtimes

Deno has a real proxy API. `Deno.createHttpClient` returns a client with its own proxy settings, and fetch accepts it through the client option. Deno stabilized it in September 2024, so it needs no unstable flag. The proxy transport can be http, https, or socks5, which means the TLS-wrapped proxy that Workers cannot use works here. Only the calls that receive the client go through the proxy.

main.ts
const proxy = new URL(Deno.env.get("FIXEDMARK_PROXY_URL")!);

// Create the client once and reuse it across requests.
const client = Deno.createHttpClient({
  proxy: {
    url: `${proxy.protocol}//${proxy.host}`,
    basicAuth: {
      username: decodeURIComponent(proxy.username),
      password: decodeURIComponent(proxy.password),
    },
  },
});

Deno.serve(async () => {
  const via = await fetch("https://fixedmark.com/api/ip", { client });
  const direct = await fetch("https://fixedmark.com/api/ip");
  return Response.json({
    proxied: (await via.text()).trim(),
    platform: (await direct.text()).trim(),
  });
});

We ran the proxied call on Deno 2.8.3 against a local CONNECT proxy. On the current Deno Deploy, the standard runtime should expose the same API, but Deploy's docs say nothing about proxies. Deploy the check above, compare the two addresses, and only then hand the proxied one to a partner. The verify egress IP guide covers what to look for.

Deno also reads HTTP_PROXY, HTTPS_PROXY, and NO_PROXY by default, per its proxy example. Prefer the explicit client. An environment variable sends every outbound call through the proxy, including ones that should stay direct. Selective proxying covers how NO_PROXY parsing differs between tools.

Supabase Edge Functions are built on Deno and take the same client. Their guide covers the runtime version caveats. On Netlify Edge Functions, test it on a deployed site first, for the reasons in the forum thread above.

Move the call off the edge, or buy the platform's IPs

Vercel

Run the route on the Node.js runtime, which is the default. Remove any export const runtime = 'edge' from the file and pass undici's ProxyAgent as the dispatcher on the one fetch that needs the fixed IP. Route only some fetches through a proxy has the full Next.js version.

Vercel's own Static IPs cost $100 a month per project on Pro, plus Private Data Transfer at regional rates. Each configured region gets two addresses from a pool shared by a small group of customers, for up to three regions. Routing Middleware never uses them. Vercel's own advice is to move the IP-restricted call into a Vercel Function and call that function from middleware. The Vercel static IPs comparison sets the options side by side.

Cloudflare

Dedicated CDN Egress IPs are for Enterprise customers. Per Cloudflare's docs, a Worker's fetch to services on your origin uses them, and connect() does not. If the allowlisted system is a third party, ask your account team whether your traffic is covered before you promise anyone an address.

Workers VPC, in beta and free during the beta, gives a Worker a binding to services inside your own network through Cloudflare Tunnel. That lets you run the relay privately, with no public URL at all, and its outbound calls leave from whatever address your own network uses. A VPC Networks binding can also send Worker traffic to the internet through Cloudflare Gateway. The docs do not say which egress IPs that path uses, so confirm with Cloudflare first.

Netlify

Use regular Netlify Functions for allowlisted calls. Private Connectivity gives functions static IPs, but it is an Enterprise add-on that requires High-Performance Edge or High-Performance Build. It works only in the cmh, fra, and lhr function regions, and it is not available for Edge Functions.

Which pattern fits your setup

Picking a fixed-IP pattern for edge code
SituationPattern
Next.js on Vercel calling one allowlisted APINode.js runtime route with a proxy dispatcher
Cloudflare Worker sending payment, payout, or order trafficRelay on a regional platform, reached over fetch
Cloudflare Worker, one low-volume call, a proxy you runconnect() with plain CONNECT and a tightly scoped credential
Supabase Edge Functions, Deno Deploy, or Netlify Edge FunctionsDeno.createHttpClient, verified on the deployed runtime
Cloudflare Enterprise, destination on your own originAsk about Dedicated CDN Egress IPs
Edge code calling a database with an IP allowlistRun the queries in the relay, which can pool connections

Whatever you pick, give the partner addresses that belong to you, not a cloud's published range. Cloud IP ranges are not an allowlist explains what goes wrong otherwise. For the database row, database connections through SOCKS5 covers pooling in the relay.

Doing this with Fixedmark

Fixedmark is in early access. It gives an app a pair of static outbound IPs behind one proxy URL, using HTTP CONNECT or SOCKS5 over TLS. Partners allowlist the pair once.

  • Cloudflare Workers are not supported directly at launch. Use the relay pattern. The Workers integration guide has the setup steps and relay code. Fixedmark's plain ports (8080 and 1080) exist for clients that cannot do TLS, and they send the token in cleartext. We have not tested the connect() path against them, so we do not support it.
  • On Deno and Supabase Edge Functions, pass the https:// proxy URL to Deno.createHttpClient. See Deno and Bun and the Supabase Edge Functions guide. Netlify Edge Functions are not supported at launch. Use a regular Netlify Function, as the Netlify guide describes.
  • On Vercel, use the Node.js runtime with undici's ProxyAgent, per the Vercel guide. The Edge runtime and Routing Middleware cannot use the proxy.
  • Limit what a leaked token can reach with a destination allowlist on plans that include one, so the relay's credential only reaches the partner's host.

To get a proxy URL and an IP pair, join early access.

Sources

Checked November 2026. Confirm current details on the vendor's site before you decide. Prices and limits change.

Blog

Frequently asked questions

Can Cloudflare Workers use an HTTP proxy?

Not through fetch. Workers' fetch has no proxy, agent, or dispatcher option. A Worker can open a raw TCP socket with connect(), speak CONNECT to a plain proxy, and upgrade to TLS once, but then it has to write HTTP by hand and send proxy credentials in cleartext.

Does https-proxy-agent work on Cloudflare Workers?

No. The node:http client in Workers is a wrapper around fetch, its Agent is a stub, and options such as createConnection are unsupported. A proxy agent has no socket to take over.

Can a Worker use an https:// proxy or SOCKS5 over TLS?

No. Both need TLS to the proxy and then a second TLS session to the destination inside it. A Workers socket can be upgraded to TLS only once, and only if it started as a plain starttls socket.

Does Deno Deploy support Deno.createHttpClient?

Deploy Classic did not, and Deno scheduled it to shut down on July 20, 2026. The current Deno Deploy runs the standard Deno runtime, where createHttpClient is stable. Deploy's docs do not mention proxies, so check the egress IP from a deployed app before you allowlist it.

Do Vercel Static IPs cover Edge Middleware?

No. Vercel's docs say Routing Middleware never uses Static IPs. Move the IP-restricted call into a Vercel Function and call that function from the middleware.

Make it fixed.

Fixedmark is in early access. Join the list to get dedicated static IPs when your region opens.