Deno's built-in HTTP client supports proxies natively via Deno.createHttpClient(). No third-party modules required for KnoxProxy integration.
The simplest approach: set HTTP_PROXY and run your script.
# Terminal
export HTTP_PROXY=http://USER:PASS@gw.knoxproxy.com:7000
export HTTPS_PROXY=http://USER:PASS@gw.knoxproxy.com:7000
deno run --allow-net script.tsUse Deno.createHttpClient() for programmatic proxy control.
const client = Deno.createHttpClient({
proxy: {
url: "http://gw.knoxproxy.com:7000",
basicAuth: { username: "USER", password: "PASS" },
},
});
const resp = await fetch("https://httpbin.org/ip", { client });
console.log(await resp.json());Target a specific country by changing the proxy username.
const client = Deno.createHttpClient({
proxy: {
url: "http://gw.knoxproxy.com:7000",
basicAuth: { username: "USER-country-us", password: "PASS" },
},
});
const resp = await fetch("https://httpbin.org/ip", { client });
console.log(await resp.json());Keep the same exit IP across multiple requests.
const client = Deno.createHttpClient({
proxy: {
url: "http://gw.knoxproxy.com:7000",
basicAuth: { username: "USER-session-abc123", password: "PASS" },
},
});
// Both requests use the same exit IP
const r1 = await fetch("https://httpbin.org/ip", { client });
const r2 = await fetch("https://httpbin.org/ip", { client });
console.log(await r1.json(), await r2.json());Run multiple proxied requests in parallel.
const urls = [
"https://httpbin.org/ip",
"https://httpbin.org/headers",
"https://httpbin.org/user-agent",
];
const results = await Promise.all(
urls.map((url) => fetch(url, { client }).then((r) => r.json()))
);
console.log(results);Catch proxy connection errors gracefully.
try {
const resp = await fetch("https://httpbin.org/ip", { client });
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
console.log(await resp.json());
} catch (err) {
console.error("Proxy request failed:", err.message);
}// KnoxProxy + Deno
// Run: deno run --allow-net knoxproxy_deno.ts
const client = Deno.createHttpClient({
proxy: {
url: "http://gw.knoxproxy.com:7000",
basicAuth: { username: "USER", password: "PASS" },
},
});
const response = await fetch("https://httpbin.org/ip", { client });
const data = await response.json();
console.log("Exit IP:", data.origin);
client.close();Each fetch() call gets a fresh exit IP. For sticky sessions, set the username to USER-session-{id} in the basicAuth config.
| Problem | Fix |
|---|---|
| TypeError: Deno.createHttpClient is not a function | Upgrade to Deno 2.x where createHttpClient is stable. On Deno 1.x, add --unstable-http flag. |
| error: Requires net access to "gw.knoxproxy.com:7000" | Run with --allow-net flag: deno run --allow-net script.ts |
USER-country-de-city-berlin-session-profile07Order matters -- geo flags before the session flag. The session name is free text; use the profile ID so the mapping is self-documenting. Password stays as issued; no flags belong there. HTTP on :7000, SOCKS5 on :7001, same credentials.
No. Deno has a built-in HTTP client with proxy support. No third-party modules are required.
Deno.createHttpClient supports HTTP/HTTPS proxies natively. For SOCKS5, use the deno-socks module or the HTTP_PROXY env var with port 7001 if your system resolver handles SOCKS.
Set the username to USER-country-{cc} (e.g., USER-country-jp for Japan) in the basicAuth configuration.
Deno Deploy does not support Deno.createHttpClient. Use HTTP_PROXY environment variables or a fetch wrapper for deployed serverless functions.
Free trial on rotating residential -- 2 minutes setup, no credit card.