Deno and Bun fetch proxy setup
Deno and Bun both proxy fetch without extra packages. Deno uses a custom HTTP client, and Bun takes a proxy option on each fetch call. Both accept the https:// proxy URL.
Docs preview: Fixedmark is not live yet. Endpoints are issued at launch, and these pages describe planned launch behavior. Anything marked planned may change. Join early access to get yours first.
Deno
Deno.createHttpClient returns a client with its own proxy settings. Pass it as client to the fetch calls that need the static IP. Credentials can stay in the URL, or go in basicAuth.
// deno run --allow-net --allow-env main.ts
const client = Deno.createHttpClient({
proxy: { url: Deno.env.get("FIXEDMARK_PROXY_URL")! },
});
const res = await fetch("https://api.partner.example/v1/orders", { client });
console.log(res.status, await res.json());// Same result, with credentials passed separately from the URL.
const proxy = new URL(Deno.env.get("FIXEDMARK_PROXY_URL")!);
const client = Deno.createHttpClient({
proxy: {
url: `${proxy.protocol}//${proxy.host}`,
basicAuth: {
username: decodeURIComponent(proxy.username),
password: decodeURIComponent(proxy.password),
},
},
});
const res = await fetch("https://api.partner.example/v1/orders", { client });# Deno's fetch reads HTTPS_PROXY and NO_PROXY with no code changes.
HTTPS_PROXY="$FIXEDMARK_PROXY_URL" deno run --allow-net --allow-env main.tsCreate the client once and reuse it. Call client.close() when a short-lived script is done with it.
Deno and SOCKS5
The Deno docs list SOCKS5 as a proxy transport for createHttpClient. Pass FIXEDMARK_SOCKS_URL as the proxy url to use it. For HTTP APIs the HTTPS proxy URL is the better choice, because SOCKS5 sends the token unencrypted.
Bun
Bun's fetch accepts a proxy option with the proxy URL. For HTTPS destinations Bun sends CONNECT and keeps TLS end to end.
const res = await fetch("https://api.partner.example/v1/orders", {
proxy: process.env.FIXEDMARK_PROXY_URL,
});
console.log(res.status, await res.json());# Without a proxy option, Bun's fetch reads HTTP_PROXY, HTTPS_PROXY,
# and NO_PROXY. It ignores socks5:// values in these variables.
HTTPS_PROXY="$FIXEDMARK_PROXY_URL" bun run server.tsBun's environment lookup ignores socks5:// values, so use the HTTPS proxy URL in HTTPS_PROXY. For databases from Bun, see databases.
socks5h://) and Bun 1.3 (proxy option and environment) against a local TLS-wrapped CONNECT proxy.Platform guides
Frequently asked questions
How do I use a proxy with fetch in Deno?
Create a client with Deno.createHttpClient({ proxy: { url } }) and pass it as the client option to fetch. Deno's fetch also reads HTTPS_PROXY from the environment.
Does Bun's fetch support a proxy?
Yes. Pass proxy: url in the fetch options. Without it, Bun reads HTTP_PROXY, HTTPS_PROXY, and NO_PROXY each time fetch runs.
Do Supabase Edge Functions support the proxy?
Supabase Edge Functions run on Deno, so Deno.createHttpClient applies. See the Supabase Edge Functions integration guide for platform details.
Make it fixed.
Fixedmark is in early access. Join the list to get dedicated static IPs when your region opens.