---
title: "Deno and Bun Fetch Proxy Setup for a Static IP"
description: "Proxy fetch through a static IP in Deno with Deno.createHttpClient and in Bun with the fetch proxy option, including SOCKS5 and environment variables."
canonical: https://fixedmark.com/docs/deno-and-bun
updated: 2026-11-03
source: Fixedmark (https://fixedmark.com), BitMask LLP
---

HTTP clients

# 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](https://fixedmark.com/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 client**

```typescript
// 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());
```

**Deno basicAuth**

```typescript
// 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 env**

```bash
# 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.ts
```

Create 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 plain SOCKS5 on port 1080 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.

**Bun fetch**

```javascript
const res = await fetch("https://api.partner.example/v1/orders", {
  proxy: process.env.FIXEDMARK_PROXY_URL,
});
console.log(res.status, await res.json());
```

**Bun env**

```bash
# 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.ts
```

Bun's environment lookup ignores `socks5://` values, so use the HTTPS proxy URL in `HTTPS_PROXY`. For databases from Bun, see [databases](https://fixedmark.com/docs/databases).

Tested with Deno 2.8 (proxy URL, basicAuth, environment, and `socks5h://`) and Bun 1.3 (proxy option and environment) against a local TLS-wrapped CONNECT proxy.

## Platform guides

- [Railway](https://fixedmark.com/integrations/railway)
- [Supabase Edge Functions](https://fixedmark.com/integrations/supabase-edge-functions)
- [Fly.io](https://fixedmark.com/integrations/fly-io)
- [Netlify](https://fixedmark.com/integrations/netlify)

## 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.
