RUNTIME ENVIRONMENT INTEGRATION

HOW TO USE PROXY POLAND WITH NODE.JS

Node.js code examples for routing HTTP/HTTPS requests, Axios, and fetch through dedicated 4G mobile proxies.

OVERVIEW

WHY NODE.JS + PROXY POLAND

Node.js is the go-to runtime for server-side automation, API scraping, and headless browser automation. By routing your Node.js requests through Proxy Poland's 4G mobile proxies, you get genuine mobile carrier IPs that bypass anti-bot systems and geo-restrictions.

STEP-BY-STEP GUIDE

SETUP INSTRUCTIONS

01

Install HTTP Client Libraries

Install axios or use the built-in https module:

npm install axios
# For SOCKS5 support:
npm install socks-proxy-agent
# For HTTPS proxy:
npm install https-proxy-agent
02

Get Proxy Credentials

Sign up at proxypoland.com and get your proxy IP, port, username, and password.

03

Configure HTTP Proxy with Axios

Route Axios requests through the proxy:

const axios = require('axios');

const response = await axios.get('https://httpbin.org/ip', {
  proxy: {
    host: 'proxy-ip',
    port: 8080,
    auth: {
      username: 'your-username',
      password: 'your-password',
    },
    protocol: 'http',
  },
});
console.log(response.data);
// Should show Polish mobile IP
04

Configure with Native https Module

Use Node.js built-in https with SOCKS5 agent:

const { SocksProxyAgent } = require('socks-proxy-agent');
const https = require('https');

const agent = new SocksProxyAgent(
  'socks5://username:password@proxy-ip:port'
);

const options = {
  hostname: 'httpbin.org',
  path: '/ip',
  agent,
};

https.get(options, (res) => {
  let data = '';
  res.on('data', chunk => data += chunk);
  res.on('end', () => console.log(JSON.parse(data)));
});
05

Use with node-fetch

Configure node-fetch with a proxy agent:

const fetch = require('node-fetch');
const { HttpsProxyAgent } = require('https-proxy-agent');

const agent = new HttpsProxyAgent(
  'http://username:password@proxy-ip:port'
);

const response = await fetch('https://httpbin.org/ip', { agent });
const data = await response.json();
console.log(data);
06

Add IP Rotation

Rotate IP between scraping sessions using the rotation API:

const axios = require('axios');

async function rotateIP() {
  const response = await axios.get(
    `http://proxy-ip:port/rotate`,
    { auth: { username: 'user', password: 'pass' } }
  );
  console.log('New IP:', response.data);
  return response.data;
}

// Rotate between scraping tasks
await rotateIP();
const result = await axios.get('https://target-site.com', { proxy: proxyConfig });
07

Verify Your IP

Check that your requests are routed through the proxy:

const axios = require('axios');

const response = await axios.get('https://httpbin.org/ip', {
  proxy: {
    host: 'proxy-ip',
    port: 8080,
    auth: { username: 'user', password: 'pass' },
  },
});
console.log(response.data.origin);
// Should show Polish mobile carrier IP
EXPERT ADVICE

PRO TIPS

Use https-proxy-agent or socks-proxy-agent for compatibility with most Node.js HTTP clients

Implement retry logic with p-retry or exponential backoff for resilient scraping

Use async/await with Promise.all for concurrent proxy-routed requests

Rotate IPs between scraping batches to avoid IP-based bans

Set realistic User-Agent headers using the user-agents npm package

POPULAR USE CASES

WORKS GREAT FOR

API scraping and data collectionPrice monitoring automationSEO rank trackingSocial media automationGeo-targeted content access
FREQUENTLY ASKED

FAQ

Which Node.js HTTP library works best with mobile proxies?+

Axios is the most popular choice due to its simple proxy configuration. For native usage, https-proxy-agent and socks-proxy-agent work with Node.js built-in modules. got and node-fetch also support proxy agents.

How do I use SOCKS5 proxies in Node.js?+

Install socks-proxy-agent (npm install socks-proxy-agent) and pass it as the agent parameter to your HTTP client. The proxy URL format is: socks5://user:pass@host:port.

How do I handle proxy authentication in Node.js?+

For Axios, set the proxy config object with auth.username and auth.password. For agent-based clients, include credentials in the proxy URL: http://username:password@host:port.

Can I use these proxies with Playwright or Puppeteer in Node.js?+

Yes. Pass --proxy-server=socks5://host:port as a launch argument. Then use page.authenticate() to provide credentials. See our dedicated Puppeteer integration guide.

How do I implement IP rotation in Node.js?+

Call the rotation endpoint (GET /rotate on your proxy) between scraping tasks. The API returns the new IP address. You can automate this with a simple setInterval or trigger it per-request.

TRY ITFREE FOR 1 HOUR

Set up Node.js with a dedicated 4G mobile proxy in under 2 minutes. No credit card required. Full proxy access during your trial.

No commitment Β· Cancel anytime Β· Setup in 2 minutes