# Axios Proxy: Setup, HTTPS Agent, SOCKS5, Fixes

> Axios proxy setup with tested code: the proxy option with auth, https-proxy-agent, SOCKS5 with socks5h, one sticky IP per request and the fix for each error.

[Home](https://quanticdata.io/) / [Blog](https://quanticdata.io/blog/) / Axios Proxy: Setup, HTTPS Agent, SOCKS5, Fixes

# Axios proxy setup in Node.js: the proxy option, an HTTPS agent, SOCKS5 and sticky sessions

Proxies · Oct 24, 2026 · 13 min read · By [Aldo Morese](https://quanticdata.io/about/), founder of QuanticData

![Routing axios through a proxy in Node.js: a sticky line from the QuanticData endpoint generator goes into the proxy option of an axios request, protocol http, host, port 8080 and the login, or into an HttpsProxyAgent or a socks5h:// agent on port 1080 with proxy false; the card lists the three things to check when the request fails.](https://quanticdata.io/blog/axios-proxy-setup/hero.webp?v=20261024h)

On this page

- [What you need before you start](https://quanticdata.io/blog/axios-proxy-setup/#what-you-need-before-you-start)
- [Three ways to send axios through a proxy](https://quanticdata.io/blog/axios-proxy-setup/#three-ways-to-send-axios-through-a-proxy)
- [Step by step: Residential Premium with the proxy option](https://quanticdata.io/blog/axios-proxy-setup/#step-by-step-residential-premium-with-the-proxy-option)
- [HTTPS URLs through https-proxy-agent](https://quanticdata.io/blog/axios-proxy-setup/#https-urls-through-https-proxy-agent)
- [SOCKS5 with socks-proxy-agent](https://quanticdata.io/blog/axios-proxy-setup/#socks5-with-socks-proxy-agent)
- [Sticky sessions per request](https://quanticdata.io/blog/axios-proxy-setup/#sticky-sessions-per-request)
- [Which proxy type for which job](https://quanticdata.io/blog/axios-proxy-setup/#which-proxy-type-for-which-job)
- [ISP proxies in axios](https://quanticdata.io/blog/axios-proxy-setup/#isp-proxies-in-axios)
- [Mobile proxies in axios](https://quanticdata.io/blog/axios-proxy-setup/#mobile-proxies-in-axios)
- [Environment variables: HTTPS_PROXY, HTTP_PROXY, NO_PROXY](https://quanticdata.io/blog/axios-proxy-setup/#environment-variables-https-proxy-http-proxy-no-proxy)
- [Axios proxy not working: errors and fixes](https://quanticdata.io/blog/axios-proxy-setup/#axios-proxy-not-working-errors-and-fixes)
- [HTTP or SOCKS5 with axios](https://quanticdata.io/blog/axios-proxy-setup/#http-or-socks5-with-axios)
- [Before you scrape](https://quanticdata.io/blog/axios-proxy-setup/#before-you-scrape)

To use a proxy in axios, add `proxy: { protocol: 'http', host, port, auth: { username, password } }` to the request config. For https:// URLs you can instead pass an HttpsProxyAgent as `httpsAgent` with `proxy: false`, and for SOCKS5 a SocksProxyAgent with `socks5h://`. Each example below shows the output it really printed on axios 1.20.0.

Axios sends requests from your own connection unless you tell it otherwise. With a proxy, the site you call sees the proxy's IP address and its country, which is what you need for scraping, price checks and testing geo rules from one machine. The option names below are the ones in the axios documentation; the values come from the QuanticData endpoint generator. The examples with output ran on 24 October 2026 with Node.js 22 through Residential Premium and mobile plans in Malaysia; USER and PASS stand for your own credentials and the printed IPs are masked.

## What you need before you start

- **Node.js 20 or newer.** The current https-proxy-agent (9.1.0) and socks-proxy-agent (10.1.0) require it, and both are ES modules: load them with `import` in a .mjs file or in a package with `"type": "module"`.
- **axios 1.16.1 or newer** if you want the built-in proxy option to tunnel https:// URLs, explained below. The examples use 1.20.0.
- **The packages:** `npm install axios https-proxy-agent socks-proxy-agent`. The agents are only needed for the agent and SOCKS5 examples.
- **A proxy plan and four values:** host, port, username and password. In the QuanticData dashboard they are under My proxies, on the plan's page, in the Endpoint generator: Connection details lists them one by one, which is how axios asks for them.

**Try it on your own targets.** Every QuanticData account gets $2 of free API usage per month.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-inline&utm_content=axios-proxy-setup) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

## Three ways to send axios through a proxy

| Method | Use it for | Port on QuanticData | Remember |
| --- | --- | --- | --- |
| The `proxy` option | An HTTP proxy for http:// and https:// URLs | 8080 | Node.js only; https:// goes through a CONNECT tunnel from axios 1.16.1 |
| https-proxy-agent as `httpsAgent` | https:// URLs on any axios 1.x | 8080 | Set `proxy: false` next to it |
| socks-proxy-agent as `httpAgent` and `httpsAgent` | SOCKS5 | 1080 | Use `socks5h://` and `proxy: false` |
| `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY` | A proxy without changing the code | 8080 | `proxy: false` turns them off for one request |

## Step by step: Residential Premium with the proxy option

![The QuanticData Endpoint generator for a Residential Premium plan: Malaysia selected as the country, Session set to Sticky with a 30-minute TTL, HTTP protocol, output format user:pass@host:port and the preview line, with the username and password blurred](https://quanticdata.io/blog/axios-proxy-setup/quanticdata-generator-malaysia-sticky.webp)

*Step 1 in the QuanticData dashboard: the country your requests should come from, a sticky session and the HTTP protocol.*

1. **Generate the line.** In the QuanticData dashboard open My proxies, then your plan. In the Endpoint generator choose the Country (Malaysia in this example, with a Region or City if you need one), set Session to Sticky with a Session TTL (minutes) longer than your job, and keep Protocol on HTTP.
2. **Open Connection details.** It lists Host, Port, Username and Password, each with a copy button.
3. **Write the proxy object.** `protocol` is the protocol of the proxy, not of the URL you call: `'http'` for port 8080, also when the URL starts with https://. Then the host, the port as a number, and `auth` with the username copied whole and the password.
4. **Set a timeout.** Without one, a request that never gets an answer waits forever.
5. **Run it.** The answer of ipinfo.io shows the exit: city, region, country and time zone.

![Connection details in the QuanticData Endpoint generator: host residentialpremium.quantumproxies.io, port 8080, the username with country my and a session ID, and the password, each with a copy button, credentials blurred](https://quanticdata.io/blog/axios-proxy-setup/quanticdata-generator-connection-details.webp)

*The four values axios asks for, one by one.*

```javascript
import axios from 'axios';

const res = await axios.get('https://ipinfo.io/json', {
  proxy: {
    protocol: 'http',
    host: 'residentialpremium.quantumproxies.io',
    port: 8080,
    auth: {
      username: 'USER-country-my-sid-axios01-ttl-60m',
      password: 'PASS',
    },
  },
  timeout: 30000,
});

const { ip, city, region, country, timezone } = res.data;
console.log(res.status, { ip, city, region, country, timezone });
```

The output, on 24 October 2026:

```
200 {
  ip: '103.255.•••.•••',
  city: 'Kuala Terengganu',
  region: 'Terengganu',
  country: 'MY',
  timezone: 'Asia/Kuala_Lumpur'
}
```

![VS Code with proxy-option.mjs: axios.get to https://ipinfo.io/json with the proxy option set to protocol http, host residentialpremium.quantumproxies.io, port 8080 and the username USER-country-my-sid-axios01-ttl-60m; the terminal shows the real result, status 200 from Kuala Terengganu, Terengganu, MY, Asia/Kuala_Lumpur, IP masked; five numbered steps beside it](https://quanticdata.io/blog/axios-proxy-setup/axios-proxy-option-residential-premium.webp)

*The proxy option and its real output. Redrawn editor, real code and result.*

The username carries the targeting: `-country-my` picks the exit country, `-sid-axios01` names the session and `-ttl-60m` keeps it for 60 minutes. A curl check through the same session a minute earlier left from the same address, which is the point of a sticky session.

**What changed in axios 1.16.1.** Older versions sent a request for an https:// URL to the proxy as plain HTTP, with the full URL in it, and the proxy made the TLS connection. Since 1.16.1 (13 May 2026) axios opens a CONNECT tunnel instead: TLS runs end to end between your code and the site, and the proxy login travels only on the CONNECT request. We checked it on the wire against a local listener: axios 1.8.4 sent `GET https://ipinfo.io/json`, axios 1.20.0 sent `CONNECT ipinfo.io:443`. Both reach the site through QuanticData; on an older axios, update it or use the agent below.

## HTTPS URLs through https-proxy-agent

An agent hands the whole connection to a library built for proxies. It behaves the same on every axios 1.x, keeps the proxy in one URL that you can store in a variable, and fails within a second when the login is wrong, where the built-in option can keep waiting.

```javascript
import axios from 'axios';
import { HttpsProxyAgent } from 'https-proxy-agent';

const httpsAgent = new HttpsProxyAgent(
  'http://USER-country-my-sid-axios02-ttl-60m:PASS@residentialpremium.quantumproxies.io:8080'
);

const res = await axios.get('https://ipinfo.io/json', {
  httpsAgent,
  proxy: false,
  timeout: 30000,
});
console.log(res.status, res.data.city, res.data.country);
// 200 Kampung Baru Subang MY
```

**Why `proxy: false`.** It tells axios not to apply any proxy of its own, including one from the environment. We tested it: with `HTTPS_PROXY` set and no `proxy: false`, axios 1.20.0 sent the request to the proxy in the environment variable and the agent was never used; with `proxy: false` the agent carried it. Keep the two together.

**Special characters in the password.** In a proxy URL, `@`, `:`, `/` and `#` in the password break the address. Encode it first: `` `http://${user}:${encodeURIComponent(pass)}@residentialpremium.quantumproxies.io:8080` ``. The proxy option does not need this, because the password has its own field.

## SOCKS5 with socks-proxy-agent

```javascript
import axios from 'axios';
import { SocksProxyAgent } from 'socks-proxy-agent';

const agent = new SocksProxyAgent(
  'socks5h://USER-country-my-sid-axios03-ttl-60m:PASS@residentialpremium.quantumproxies.io:1080'
);

const res = await axios.get('https://ipinfo.io/json', {
  httpAgent: agent,
  httpsAgent: agent,
  proxy: false,
  timeout: 30000,
});
console.log(res.status, res.data.city, res.data.country);
// 200 Ipoh MY
```

- **socks5h, not socks5.** With `socks5://` the agent looks up the site's address on your machine and sends the proxy an IP; with `socks5h://` the proxy resolves the name, so the lookup happens in the exit country too.
- **Both agents.** `httpAgent` covers http:// URLs and `httpsAgent` covers https:// URLs; set both and every request goes through SOCKS5.
- **Port 1080.** SOCKS5 has its own port on every QuanticData network; port 8080 is HTTP only.

![VS Code with agents.mjs: an HttpsProxyAgent on http://USER-country-my-sid-axios02-ttl-60m:PASS@residentialpremium.quantumproxies.io:8080 and a SocksProxyAgent on socks5h:// port 1080, passed as httpsAgent with proxy false; the terminal shows two real results in Malaysia, Kampung Baru Subang and Ipoh; five numbered steps beside it](https://quanticdata.io/blog/axios-proxy-setup/axios-https-proxy-agent-socks5.webp)

*An HTTP agent and a SOCKS5 agent in one run, both exits in Malaysia. Redrawn editor, real code and output.*

## Sticky sessions per request

A scraper that logs in, keeps a cart or walks through pages of results should keep one IP for that job, and a second job should get a different one. With QuanticData the session lives in the username, so the simplest pattern is one agent per session ID, created once and reused:

```javascript
import axios from 'axios';
import { HttpsProxyAgent } from 'https-proxy-agent';

const GATEWAY = 'residentialpremium.quantumproxies.io:8080';
const agents = new Map();

// One agent per session ID: the same -sid- keeps its IP, a new one gets a new IP.
function agentFor(sid) {
  if (!agents.has(sid)) {
    const user = `USER-country-my-sid-${sid}-ttl-60m`;
    agents.set(sid, new HttpsProxyAgent(`http://${user}:PASS@${GATEWAY}`));
  }
  return agents.get(sid);
}

async function exitOf(sid) {
  const res = await axios.get('https://ipinfo.io/json', {
    httpsAgent: agentFor(sid),
    proxy: false,
    timeout: 30000,
  });
  return `${res.data.ip} ${res.data.city}`;
}

const a = await exitOf('acct01');
const b = await exitOf('acct01');
const c = await exitOf('acct02');
console.log('acct01 first ', a);
console.log('acct01 again ', b, a === b ? 'same IP' : 'new IP');
console.log('acct02       ', c, c === a ? 'same IP' : 'new IP');
```

```
acct01 first  113.211.•••.••• Petaling Jaya
acct01 again  113.211.•••.••• Petaling Jaya same IP
acct02        124.13.•••.••• Taman Petaling new IP
```

![VS Code with sticky.mjs: one HttpsProxyAgent per session ID, the username built as USER-country-my-sid-id-ttl-60m; the terminal shows the real result, acct01 twice on the same masked IP in Petaling Jaya and acct02 on a new IP; four numbered steps beside it](https://quanticdata.io/blog/axios-proxy-setup/axios-sticky-sessions.webp)

*Same session ID, same IP; new session ID, new IP. Redrawn editor, real code and output.*

- **Lifetime.** `-ttl-` goes up to 1440 minutes, a full day. After it ends, the next request on that ID gets a new IP.
- **With the proxy option.** Put a different username in `proxy.auth` for each job. For https:// URLs axios keeps a separate tunnel for each proxy and login, so two usernames never share a connection; in our test two session IDs in one process left from two different IPs.
- **Many sessions at once.** In the generator, Generate 10 sessions makes ten sticky lines with their own session IDs, ten by default and as many as the Quantity field says; Copy all or Download takes them out.

## Which proxy type for which job

| Proxy type | In axios | Good for |
| --- | --- | --- |
| Residential Premium | residentialpremium.quantumproxies.io, HTTP 8080 or SOCKS5 1080; country, region, city or ISP and the session in the username | Most scraping and testing: home IPs in the country you choose, for example [Malaysia residential proxies](https://quanticdata.io/proxies/malaysia/) |
| ISP | One fixed IP per line from Assigned IPs, HTTP 50100 or SOCKS5 50101, the plan's username and password | Jobs that should keep one address while the plan runs: logged-in sessions, allowlists on the other side |
| Mobile | mobile.quantumproxies.io, HTTP 8080 or SOCKS5 1080, `-type-mobile` in the username; Global, USA, EU or Asia gateway; IP whitelist available | Mobile-first sites and APIs that treat carrier IPs differently |

## ISP proxies in axios

An ISP plan gives fixed IPs. In the dashboard, Proxy endpoints, Assigned IPs lists them; with Output format set to Proxy URL each line is already in the form an agent takes, `http://USER:PASS@IP:50100`. Copy one line per job: that IP stays the same while the plan is active, so there is no session ID in the username. The code is the same as for Residential Premium; the sample IP below is masked.

![The Assigned IPs panel of a QuanticData ISP plan: Protocol HTTP / HTTPS or SOCKS5, Output format Proxy URL, five IPs masked with port 50100 and username USER, and the formatted output as http://USER:PASS@IP:50100 lines ready to copy](https://quanticdata.io/blog/axios-proxy-setup/quanticdata-isp-assigned-ips-proxy-url.webp)

*ISP plan: one fixed IP per line, already in proxy URL form. Sample IPs masked.*

```javascript
// the line from Assigned IPs, as an agent
const isp = new HttpsProxyAgent('http://USER:PASS@91.•••.•••.74:50100');
const res = await axios.get('https://example.com/', { httpsAgent: isp, proxy: false, timeout: 30000 });

// or as the proxy option
const res2 = await axios.get('https://example.com/', {
  proxy: { protocol: 'http', host: '91.•••.•••.74', port: 50100, auth: { username: 'USER', password: 'PASS' } },
  timeout: 30000,
});
```

For SOCKS5 switch the panel's Protocol to SOCKS5: the port in the list becomes 50101, and the line goes into a SocksProxyAgent with `socks5h://`. The IP your requests leave from is the IP in the line.

## Mobile proxies in axios

Mobile works like Residential Premium with two changes: the host is `mobile.quantumproxies.io` and the username carries `-type-mobile`. Choose the gateway (Global, USA, EU or Asia) and the protocol, HTTP 8080 or SOCKS5 1080, in the mobile plan's generator. One client per plan with `axios.create` keeps the code tidy:

![The Mobile Endpoint generator: Malaysia selected, Global, USA, EU and Asia gateways, Session set to Sticky, HTTP 8080 or SOCKS5 1080, output format and the preview line with -type-mobile, and the IP whitelist section below, credentials blurred](https://quanticdata.io/blog/axios-proxy-setup/quanticdata-generator-mobile-malaysia.webp)

*Mobile: gateway, ports, a sticky session and the IP whitelist.*

```javascript
import axios from 'axios';

const mobile = axios.create({
  proxy: {
    protocol: 'http',
    host: 'mobile.quantumproxies.io',
    port: 8080,
    auth: {
      username: 'USER-country-my-type-mobile-sid-m01-ttl-30m',
      password: 'PASS',
    },
  },
  timeout: 30000,
});

const res = await mobile.get('https://ipinfo.io/json');
console.log(res.status, res.data.city, res.data.country);
// 200 Kuala Lumpur MY
```

![VS Code with isp-mobile.mjs: an axios.create client for an ISP IP 91.x.x.74 on port 50100 with USER and PASS (IP masked) and one for mobile.quantumproxies.io port 8080 with USER-country-my-type-mobile-sid-axios04-ttl-30m; the terminal shows the real mobile result, Kuala Lumpur, MY; five numbered steps beside it](https://quanticdata.io/blog/axios-proxy-setup/axios-isp-mobile-clients.webp)

*One axios client per plan: ISP (defined, IP masked) and mobile (run). Redrawn editor, real code and output.*

Mobile plans also offer IP whitelist authentication: add your server's IP in the generator, then use the host:port list the panel gives for it and leave `auth` out of the proxy object. Nothing secret sits in the code, which is handy on a fixed server.

## Environment variables: HTTPS_PROXY, HTTP_PROXY, NO_PROXY

When a request has no `proxy` setting, axios reads the proxy from the environment, so a script can go through QuanticData without a code change:

```
HTTPS_PROXY='http://USER-country-my-sid-job01-ttl-60m:PASS@residentialpremium.quantumproxies.io:8080' \
NO_PROXY='localhost,127.0.0.1' node app.mjs
```

- `HTTPS_PROXY` is used for https:// URLs and `HTTP_PROXY` for http:// URLs; `NO_PROXY` lists hosts that go direct.
- `proxy: false` on a request ignores them, as in the agent examples above.
- On Node versions with built-in proxy support started with `NODE_USE_ENV_PROXY=1` or `--use-env-proxy`, axios leaves the environment variables to Node; an explicit `proxy` option is still handled by axios.

## Axios proxy not working: errors and fixes

![VS Code with errors.mjs and its real output: HTTP sent to port 1080 gives ECONNRESET, protocol https on the HTTP port gives EPROTO, a wrong SOCKS5 password gives Socks5 Authentication failed, and HTTP on port 8080 with the right login returns 200 from MY; four numbered steps beside it](https://quanticdata.io/blog/axios-proxy-setup/axios-proxy-errors.webp)

*Three mistakes and the fix, with the errors axios really printed. Redrawn editor, real code and output.*

| What you see | Usual cause | Fix |
| --- | --- | --- |
| The request hangs (https:// URL with the proxy option), `Parse Error: Missing expected CR after response line`, or `Proxy connection ended before receiving CONNECT response` | Username or password wrong, or a country code in the username that does not exist | Copy the line again from the generator; set `timeout` on every request and, for https:// URLs, use https-proxy-agent so a bad login fails at once |
| `ECONNRESET` or socket hang up | HTTP sent to the SOCKS5 port 1080 | HTTP on 8080, SOCKS5 on 1080 |
| `EPROTO` ... wrong version number | `protocol: 'https'` in the proxy object | `protocol: 'http'`: it is the proxy's protocol, not the URL's |
| `Socks5 Authentication failed` | Wrong username or password on SOCKS5 | Copy both again; encode special characters in the password |
| `Socket closed` after the timeout | A SOCKS agent pointed at port 8080 | Port 1080 for SOCKS5 |
| Your own IP in the answer | The code runs in a browser, where the proxy option does nothing, or `proxy: false` without an agent | Run it in Node.js; give the request a proxy or an agent |
| Wrong country | No `-country-` in the username | Generate the line with a country |

One test outside your code settles most cases in a minute. If this returns an address in the right country, the proxy works and the problem is in the axios config; see [how to use a proxy with curl](https://quanticdata.io/blog/how-to-use-a-proxy-with-curl/) for more.

```bash
curl -x http://residentialpremium.quantumproxies.io:8080 \
  -U "USER-country-my-sid-test-ttl-10m:PASS" https://ipinfo.io/json
```

## HTTP or SOCKS5 with axios

Start with HTTP on port 8080 and the proxy option: no extra package, and since axios 1.16.1 https:// URLs are tunnelled end to end. Pick SOCKS5 on port 1080 when the rest of your stack already speaks SOCKS or you want the proxy to resolve hostnames; the details are on the page for [SOCKS5 proxies](https://quanticdata.io/socks5-proxies/). For pages that need a real browser, the same lines work in [Puppeteer](https://quanticdata.io/blog/how-to-use-a-proxy-in-puppeteer/); for fetch and undici, see [how to use a proxy in Node.js](https://quanticdata.io/blog/how-to-use-a-proxy-in-nodejs/); the Python equivalent is [Python Requests](https://quanticdata.io/blog/how-to-use-a-proxy-with-python-requests/). The plans themselves are on the pages for [QuanticData residential proxies](https://quanticdata.io/residential-proxies/), [ISP proxies](https://quanticdata.io/isp-proxies/) and [mobile proxies](https://quanticdata.io/mobile-proxies/).

## Before you scrape

A proxy changes where requests come from, not what you are allowed to collect. Keep to each site's terms and to the law where you work, send requests at a pace the site can handle, and give each job its own session.

### Sources & further reading

- [axios documentation: request config (proxy, httpAgent and httpsAgent)](https://axios.rest/pages/advanced/request-config)
- [axios changelog: v1.16.1, HTTPS through an HTTP proxy](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [https-proxy-agent: README](https://github.com/TooTallNate/proxy-agents/tree/main/packages/https-proxy-agent)
- [socks-proxy-agent: README](https://github.com/TooTallNate/proxy-agents/tree/main/packages/socks-proxy-agent)
- [RFC 9110: HTTP Semantics, the CONNECT method](https://www.rfc-editor.org/rfc/rfc9110#name-connect)
- [RFC 1928: SOCKS Protocol Version 5](https://www.rfc-editor.org/rfc/rfc1928)

## FAQ

Quick answers on axios proxy.

[Something else? Ask us](mailto:hello@quanticdata.io)

### How do I set a proxy in axios?

Add a proxy object to the request config: `proxy: { protocol: 'http', host, port, auth: { username, password } }`. With QuanticData the host is residentialpremium.quantumproxies.io, the port 8080, and the username carries the country and the session. Set it on one request, or on an instance with `axios.create`. The option works in Node.js only.

### Does the axios proxy option work with HTTPS URLs?

Yes. Since axios 1.16.1 a request for an https:// URL goes through a CONNECT tunnel, with TLS end to end and the proxy login sent only on the CONNECT. Keep `protocol: 'http'`: it is the protocol of the proxy, not of the URL. On older versions, update axios or pass an HttpsProxyAgent as `httpsAgent` with `proxy: false`.

### How do I use a SOCKS5 proxy with axios?

Install socks-proxy-agent, create `new SocksProxyAgent('socks5h://USER:PASS@host:1080')` and pass it as both `httpAgent` and `httpsAgent`, with `proxy: false`. Use socks5h so the proxy resolves hostnames; with socks5 the lookup happens on your machine.

### What does proxy: false do in axios?

It turns off every proxy axios would apply itself, including the HTTP_PROXY and HTTPS_PROXY environment variables. Set it whenever you pass a proxy agent: in our test with HTTPS_PROXY set and no `proxy: false`, axios 1.20.0 sent the request to the environment proxy and ignored the agent.

### Does axios use the HTTP_PROXY and HTTPS_PROXY environment variables?

Yes, when a request has no proxy setting: HTTPS_PROXY for https:// URLs, HTTP_PROXY for http:// URLs, and NO_PROXY for hosts that should go direct. A proxy option on the request takes their place, and `proxy: false` ignores them.

### Why is my axios proxy not working?

Check, in order: the port matches the type (HTTP 8080, SOCKS5 1080 on QuanticData), `protocol` is `'http'`, the username is copied whole with a country code that exists, and the code runs in Node.js, not in a browser. A request that hangs, "Parse Error: Missing expected CR after response line" or "Proxy connection ended before receiving CONNECT response" means the login or the country code is wrong: copy the line again from the generator.

### How do I keep the same IP across axios requests?

Use a sticky session: put the same `-sid-` in the username, for example USER-country-my-sid-job01-ttl-60m, and reuse it. The IP holds for the lifetime in `-ttl-`, up to 1440 minutes. A new session ID gives a new IP. One agent per session ID, created once, is the simplest way to manage it.

## A sticky IP for every axios job

Residential Premium, ISP and mobile proxies with country targeting and sticky sessions up to 1440 minutes, HTTP and SOCKS5, copied straight from the endpoint generator into your axios config.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-end&utm_content=axios-proxy-setup) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

## Related reading

- [Helium Scraper Proxy: List, Rotation and Fixes](https://quanticdata.io/blog/helium-scraper-proxy-setup/): Proxies · Open File, Proxy List and add a row with the address, port, user name and password; then open Project, Settings and set Enable Proxies to True. Below: the values for Residential Premium, ISP and mobile, what each of the four Proxies settings does, rotation with sticky sessions or RotateProxy, a check in Helium Scraper's browser and a fix for each mistake.
- [aiohttp Proxy Setup: Auth, Sessions and SOCKS5](https://quanticdata.io/blog/aiohttp-proxy-setup/): Proxies · Pass the proxy URL as proxy= on a request or on the ClientSession, with the login in the URL or in a Proxy-Authorization header: proxy_auth=aiohttp.BasicAuth still works but is deprecated since aiohttp 3.14. Below: real code and real output, SOCKS5 through aiohttp-socks, one sticky session per asyncio task, ISP and mobile lines, and the exact error each mistake raises.
- [Changedetection.io Proxy: Setup and Fixes](https://quanticdata.io/blog/changedetection-proxy-setup/): Proxies · Open Settings, CAPTCHA & Proxies and fill a row of Extra Proxies: a Name and a Proxy URL that starts with http://. Then pick that name in each watch under Edit, Request, Proxy. Below: Residential Premium, ISP and mobile lines, the Chrome fetcher, proxies.json, Check/Scan all and a fix for each message.

---

Source: https://quanticdata.io/blog/axios-proxy-setup/ · Site index for AI: https://quanticdata.io/llms.txt
