No-code automation platform connecting 6,000+ apps. Use Zapier Code steps to route HTTP requests through KnoxProxy for proxied web scraping, API polling, and data enrichment workflows.
Log in to Zapier and click "Create Zap". Add your trigger (e.g., Schedule, Webhook, or any app trigger).
Click "+" to add an action. Search for "Code by Zapier" and select "Run JavaScript".
Add input fields for proxy_url and target_url. Set proxy_url to your KnoxProxy gateway URL.
proxy_url: http://USER:PASS@gw.knoxproxy.com:7000
target_url: https://httpbin.org/ipIn the Code editor, write a fetch request using the proxy URL via the https-proxy-agent pattern.
Modify the proxy username to target a specific country.
http://USER-country-gb:PASS@gw.knoxproxy.com:7000Click "Test step" to verify the proxied response. Review the output and turn on the Zap.
// Zapier Code by Zapier - Run JavaScript
// Input Data: proxy_url, target_url
const proxyUrl = inputData.proxy_url;
const targetUrl = inputData.target_url;
// Parse proxy URL
const url = new URL(proxyUrl);
const proxyHost = url.hostname;
const proxyPort = url.port;
const proxyAuth = Buffer.from(
`${url.username}:${url.password}`
).toString('base64');
const http = require('http');
const https = require('https');
const response = await new Promise((resolve, reject) => {
const proxyReq = http.request({
host: proxyHost,
port: proxyPort,
method: 'CONNECT',
path: new URL(targetUrl).host + ':443',
headers: {
'Proxy-Authorization': `Basic ${proxyAuth}`,
},
});
proxyReq.on('connect', (res, socket) => {
const req = https.request(
targetUrl,
{ socket, agent: false },
(res) => {
let data = '';
res.on('data', (chunk) => (data += chunk));
res.on('end', () => resolve(data));
}
);
req.end();
});
proxyReq.on('error', reject);
proxyReq.end();
});
output = { body: response };Each Zap run gets a new IP automatically. For sticky sessions within a multi-step Zap, use USER-session-{zapRunId} as the proxy username.
| Problem | Fix |
|---|---|
| Error: connect ECONNREFUSED | Verify gw.knoxproxy.com:7000 is correct. Ensure your KnoxProxy plan allows cloud platform IPs. |
| Output is empty or undefined | Ensure the last line sets output = { body: response }. Zapier requires the output variable. |
| StepError: Code timed out after 30s | Simplify the request or target a faster endpoint. Zapier Code steps have a 30s limit on lower plans. |
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. The Webhooks by Zapier action has no proxy field of its own, so it cannot route through KnoxProxy directly. You need a Code by Zapier step running JavaScript instead, which builds the CONNECT request manually using your proxy_url and target_url input data.
Code by Zapier, the step you need to route requests through KnoxProxy, is available starting on Professional plans and above. Free and Starter plans do not include it at all, so routing Zap traffic through a proxy like KnoxProxy requires at least a Professional subscription first.
Use Zapier Secret, referenced as inputData.secret, to store your KnoxProxy password instead of hardcoding it directly in the Code step's JavaScript. The Code step then reads the secret at runtime to build the Proxy-Authorization header, keeping credentials out of the Zap's visible code and export files.
Yes, a Looping by Zapier step lets you iterate over a list of URLs and route each one through the same Code step you built for KnoxProxy. Every iteration reuses the proxy_url and target_url input data already configured, and each Zap run gets a fresh IP automatically unless you set a sticky USER-session-{zapRunId} username.
Rotating residential proxies -- 3 minutes setup, instant activation, 14-day money-back guarantee.