How to Use Dataimpulse Residential Proxies with Node.js and Axios for Web Scraping (Beginner Guide for Windows, macOS, and Linux)
A beginner-friendly, copy-paste walkthrough for routing Node.js requests through Dataimpulse pay-as-you-go residential proxies with Axios and Cheerio, including exit-IP verification, retries, concurrency limits, and a SOCKS5 variant.
Overview
Dataimpulse is a pay-as-you-go proxy provider offering residential and mobile IPs from a pool of 90M+ addresses over HTTP and SOCKS5. Because billing follows the traffic you actually use rather than a fixed monthly plan, it fits high-volume web scraping and large-scale data collection where usage is bursty.
This tutorial routes Node.js requests through a Dataimpulse residential endpoint using Axios and Cheerio, then hardens the script with retries and a concurrency cap. The code behaves identically on Windows, macOS, and Linux; only the shell commands for setting environment variables differ. The same pattern works with any provider that issues a gateway host, port, and username/password.
By the end you will be able to:
- Install the Node.js packages needed for proxy-aware scraping.
- Keep Dataimpulse credentials out of your source files.
- Verify that requests are leaving through the proxy.
- Scrape and parse a page with Cheerio.
- Add retries, backoff, and a concurrency limit.
- Switch the same client from HTTP to SOCKS5.
What you need
- Node.js 18 or newer with npm
- A Dataimpulse account with pay-as-you-go credit
- The gateway host, port, and username/password from your Dataimpulse dashboard
- A target page you are permitted to scrape
Choose an endpoint type
| Endpoint | Best for | Node.js agent package |
|---|---|---|
| HTTP(S) proxy | Axios, Fetch, and most HTTP scraping libraries | https-proxy-agent |
| SOCKS5 | Tools that expect SOCKS, or one agent for all outbound traffic | socks-proxy-agent |
Start with the HTTP endpoint unless a library refuses to accept a proxy configuration.
Steps
1. Create the project
mkdir dataimpulse-axios-scraper
cd dataimpulse-axios-scraper
npm init -y
2. Install the dependencies
npm install axios cheerio https-proxy-agent
Add the SOCKS5 agent only if you plan to use step 7:
npm install socks-proxy-agent
3. Set your Dataimpulse credentials as environment variables
Keeping credentials out of source files stops them from leaking into a repository or a shared screenshot. Copy the host, port, username, and password values from your Dataimpulse dashboard.
macOS and Linux:
export PROXY_HOST="your-gateway-host"
export PROXY_PORT="your-gateway-port"
export PROXY_USER="your-username"
export PROXY_PASS="your-password"
Windows PowerShell:
$env:PROXY_HOST = "your-gateway-host"
$env:PROXY_PORT = "your-gateway-port"
$env:PROXY_USER = "your-username"
$env:PROXY_PASS = "your-password"
These values apply to the current terminal session only. If your password contains @, :, or /, the script below URL-encodes it with encodeURIComponent, so you can paste it as-is.
4. Confirm the exit IP
Create a file named check-ip.js:
const axios = require('axios');
const { HttpsProxyAgent } = require('https-proxy-agent');
const proxyUrl = `http://${process.env.PROXY_USER}:${encodeURIComponent(process.env.PROXY_PASS)}@${process.env.PROXY_HOST}:${process.env.PROXY_PORT}`;
const client = axios.create({
httpsAgent: new HttpsProxyAgent(proxyUrl),
proxy: false,
timeout: 20000,
});
(async () => {
const { data } = await client.get('https://api.ipify.org?format=json');
console.log('Exit IP:', data.ip);
})();
Run it a few times:
node check-ip.js
If the gateway rotates the exit IP, you will see a different address on each run, which is the normal behaviour for residential traffic. If you need several requests to leave from the same address, use the session or sticky parameter format documented in your Dataimpulse dashboard instead of trying to pin an IP inside the script. Setting proxy: false is deliberate: the explicit agent handles tunnelling, and leaving Axios proxy auto-detection on can conflict with it.
5. Scrape a page and parse it
Create scrape.js. This version adds a descriptive User-Agent, an Accept-Language header, and a retry helper:
const axios = require('axios');
const { load } = require('cheerio');
const { HttpsProxyAgent } = require('https-proxy-agent');
const proxyUrl = `http://${process.env.PROXY_USER}:${encodeURIComponent(process.env.PROXY_PASS)}@${process.env.PROXY_HOST}:${process.env.PROXY_PORT}`;
const client = axios.create({
httpsAgent: new HttpsProxyAgent(proxyUrl),
proxy: false,
timeout: 20000,
headers: {
'User-Agent': 'Mozilla/5.0 (compatible; ProxyScoutExample/1.0)',
'Accept-Language': 'en-US,en;q=0.9',
},
});
async function getWithRetry(url, attempts = 3) {
for (let i = 1; i <= attempts; i++) {
try {
return await client.get(url);
} catch (error) {
const status = error.response && error.response.status;
const retryable = !status || status === 429 || status >= 500;
if (!retryable || i === attempts) throw error;
const backoff = 1000 * 2 ** (i - 1);
console.warn(`Attempt ${i} failed (${status || error.code}); retrying in ${backoff} ms`);
await new Promise((resolve) => setTimeout(resolve, backoff));
}
}
}
(async () => {
const { data: html } = await getWithRetry('https://example.com/');
const $ = load(html);
console.log('Title:', $('title').text().trim());
$('a').slice(0, 5).each((index, element) => {
console.log('Link:', $(element).attr('href'));
});
})();
node scrape.js
Authentication failures (HTTP 407) and most 4xx responses are treated as non-retryable, because repeating the same request with the same credentials usually reproduces the same result. Transient network errors, 429 responses, and 5xx responses are retried with exponential backoff.
6. Add a concurrency limit instead of firing everything at once
The rotating gateway handles IP changes for you, so the main risk to your job is hammering a single target too quickly. Process URLs in small batches and lower the batch size if you start seeing 403 or 429 responses:
async function scrapeAll(urls, concurrency = 4) {
const results = [];
for (let i = 0; i < urls.length; i += concurrency) {
const batch = urls.slice(i, i + concurrency);
const settled = await Promise.allSettled(batch.map((url) => getWithRetry(url)));
results.push(...settled);
}
return results;
}
Start with a concurrency of 2 to 4 for a new target, watch the failure rate, and only then scale up. A slower run that completes is cheaper than a fast run that gets blocked, especially on pay-as-you-go billing where failed requests still consume traffic.
7. Optional: switch the same client to SOCKS5
If a library or CLI tool only accepts SOCKS, swap the agent. Use the SOCKS5 port from your Dataimpulse dashboard, not the HTTP port:
const { SocksProxyAgent } = require('socks-proxy-agent');
const socksUrl = `socks5://${process.env.PROXY_USER}:${encodeURIComponent(process.env.PROXY_PASS)}@${process.env.PROXY_HOST}:${process.env.PROXY_PORT}`;
const agent = new SocksProxyAgent(socksUrl);
const client = axios.create({
httpAgent: agent,
httpsAgent: agent,
proxy: false,
timeout: 20000,
});
Assigning the same agent to both httpAgent and httpsAgent keeps plain HTTP and HTTPS targets consistent, which matters when a scrape follows redirects across both schemes.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
407 Proxy Authentication Required |
Wrong or missing username/password | Recheck the dashboard credentials and confirm the URL-encoding of special characters |
ECONNREFUSED or immediate timeout on connect |
Wrong port, or HTTP port used for a SOCKS5 request | Match the port to the protocol you selected |
| HTTP URLs work, HTTPS URLs fail | Axios is using its built-in proxy handling instead of the agent | Use https-proxy-agent and set proxy: false |
Frequent 403 or 429 from the target site |
Request rate too high for that host | Reduce concurrency to 1 or 2, increase backoff, keep headers realistic |
| Requests succeed in the browser but fail in Node | Browser and terminal have different proxy settings | Re-export the environment variables in the terminal running the script |
| Certificate or TLS warnings appear | Intercepted or mismatched TLS | Do not disable certificate validation; verify the target URL and proxy configuration |
Summary
You set up a Node.js project that sends Axios requests through a Dataimpulse residential proxy, verified the exit IP, parsed HTML with Cheerio, and added retries, backoff, and a concurrency cap. Because the gateway rotates exits for you, the engineering effort belongs in pacing, error handling, and observability rather than in manual IP switching. For a first run, confirm the exit IP, scrape a single page, then increase concurrency gradually while watching your failure rate and traffic consumption. Always respect the target site's terms of service, robots directives, and applicable law when collecting data.
Related reading on ProxyScout.net: rotating residential proxies at scale, Python-based scraping with Dataimpulse, and configuring Dataimpulse proxies with Proxifier on Windows.