Node.js
This guide explains how to use Evomi proxies with Node.js using Axios (the most popular HTTP client) and node-fetch. Both libraries support HTTP proxies, and SOCKS5 support is available via additional packages.
Prerequisites
- Node.js 18+ installed
- Your Evomi proxy credentials (username and password)
Axios
Installation
npm install axiosHTTP Proxy
Axios has built-in support for HTTP/HTTPS proxies:
const axios = require('axios');
const client = axios.create({
proxy: {
protocol: 'http',
host: 'rp.evomi.com',
port: 1000,
auth: {
username: 'your_username',
password: 'your_password_session-anychars_mode-speed',
},
},
});
client.get('https://ip.evomi.com/s')
.then(res => console.log('Proxy IP:', res.data.trim()))
.catch(err => console.error('Error:', err.message));SOCKS5 Proxy
Axios does not natively support SOCKS5. Use socks-proxy-agent:
npm install socks-proxy-agentconst axios = require('axios');
const { SocksProxyAgent } = require('socks-proxy-agent');
const proxyUser = 'your_username';
const proxyPass = 'your_password_session-anychars_mode-speed';
const agent = new SocksProxyAgent(
`socks5h://${proxyUser}:${proxyPass}@rp.evomi.com:1002`
);
axios.get('https://ip.evomi.com/s', {
httpAgent: agent,
httpsAgent: agent,
proxy: false,
})
.then(res => console.log('Proxy IP:', res.data.trim()))
.catch(err => console.error('Error:', err.message));ℹ️
When using an agent, set
proxy: false in Axios options to prevent Axios from trying to apply its own proxy configuration on top of the agent.node-fetch
Installation
npm install node-fetch https-proxy-agentHTTP Proxy
const fetch = require('node-fetch');
const { HttpsProxyAgent } = require('https-proxy-agent');
const proxyUser = 'your_username';
const proxyPass = 'your_password_session-anychars_mode-speed';
const agent = new HttpsProxyAgent(
`http://${proxyUser}:${proxyPass}@rp.evomi.com:1000`
);
fetch('https://ip.evomi.com/s', { agent })
.then(res => res.text())
.then(body => console.log('Proxy IP:', body.trim()))
.catch(err => console.error('Error:', err.message));SOCKS5 Proxy
npm install node-fetch socks-proxy-agentconst fetch = require('node-fetch');
const { SocksProxyAgent } = require('socks-proxy-agent');
const proxyUser = 'your_username';
const proxyPass = 'your_password_session-anychars_mode-speed';
const agent = new SocksProxyAgent(
`socks5h://${proxyUser}:${proxyPass}@rp.evomi.com:1002`
);
fetch('https://ip.evomi.com/s', { agent })
.then(res => res.text())
.then(body => console.log('Proxy IP:', body.trim()))
.catch(err => console.error('Error:', err.message));ES Modules Syntax
If your project uses ES modules ("type": "module" in package.json), use import instead of require:
import axios from 'axios';
import { SocksProxyAgent } from 'socks-proxy-agent';
const agent = new SocksProxyAgent(
'socks5h://your_username:[email protected]:1002'
);
const { data } = await axios.get('https://ip.evomi.com/s', {
httpAgent: agent,
httpsAgent: agent,
proxy: false,
});
console.log('Proxy IP:', data.trim());Evomi Proxy Endpoints
| Proxy Type | HTTP | HTTPS | SOCKS5 |
|---|---|---|---|
| Residential | rp.evomi.com:1000 |
rp.evomi.com:1001 |
rp.evomi.com:1002 |
| Mobile | mp.evomi.com:3000 |
mp.evomi.com:3001 |
mp.evomi.com:3002 |
| Datacenter | dcp.evomi.com:2000 |
dcp.evomi.com:2001 |
dcp.evomi.com:2002 |
Tips and Troubleshooting
- Credentials: Double-check your username and password. The password format is
your_password_session-anychars_mode-speed. proxy: falsewith agents: When usinghttpAgent/httpsAgentin Axios, always setproxy: falseto avoid conflicts.socks5h://vssocks5://: Usesocks5h://to resolve DNS on the proxy server (recommended). Usesocks5://for local DNS resolution.- Timeouts: Set timeouts to avoid hanging requests:
axios.get(url, { timeout: 15000 })orfetch(url, { agent, signal: AbortSignal.timeout(15000) }). - Special characters: If your password contains special characters, URL-encode them with
encodeURIComponent(). - node-fetch v3: Version 3+ is ESM-only. If using CommonJS, stick with
node-fetch@2or switch to ES modules.