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 ships a built-in HTTP client with native proxy support through Deno.createHttpClient(), so no third-party modules are required for KnoxProxy integration. You can also skip the client entirely and just set the HTTP_PROXY and HTTPS_PROXY environment variables before running your script.
Deno.createHttpClient supports HTTP and HTTPS proxies natively, but it has no built-in SOCKS5 support. For SOCKS5, use the deno-socks module or fall back to the HTTP_PROXY environment variable on the KnoxProxy SOCKS5 port 7001, provided your system resolver can handle the SOCKS handshake correctly.
Set the username to USER-country-{cc} in the basicAuth object passed to Deno.createHttpClient(), for example USER-country-jp for Japan. KnoxProxy reads the country suffix from the proxy username and routes your request through an exit node in that country automatically, with no other configuration changes needed.
Deno Deploy does not support Deno.createHttpClient, so the createHttpClient examples in this guide will not work there directly. Instead, use HTTP_PROXY and HTTPS_PROXY environment variables, or write a small fetch wrapper that injects your KnoxProxy credentials into each request, to route traffic through KnoxProxy from deployed serverless functions.
Rotating residential proxies -- 2 minutes setup, instant activation, 14-day money-back guarantee.