# https-proxy-agent — card for AI agents

HTTP/HTTPS proxy agent for Node.js to route requests through corporate proxies.

Category: HTTP clients and networking · npm package `https-proxy-agent` · latest version 9.1.0 (checked 2026-11-01)
Install: `npm install https-proxy-agent`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Numbers (AgentGid data)
- Gid Score: 63.4 (#771 of all tools, 30 of 126 in its category)
- Used in 33 public projects set up for AI coding agents (0.5%)
- Downloads last week: 393,621,569 (as of 2026-11-24), +40.7% over 4 weeks
- GitHub stars: 1,171 (as of 2026-11-24)
- Last push: 2026-11-17

## Often used with
Vitest 87.9%, undici 78.8%, tsx 72.7%, Zod 84.8%, ws 69.7%, Model Context Protocol SDK (JavaScript) 63.6%

## Links
- AgentGid page: https://agentgid.com/tools/https-proxy-agent/
- Homepage: https://github.com/TooTallNate/proxy-agents#readme
- Repository: https://github.com/TooTallNate/proxy-agents


## https-proxy-agent: send Node.js requests through a proxy

https-proxy-agent is a small free JavaScript package for Node.js. It makes your server's outgoing secure requests and WebSocket connections go through a proxy server, as many company and school networks require. You give it the proxy address once and hand it to each request.

### Where to use it
- Reach outside services behind a company proxy: Your Node.js tool runs on a work network where every connection must pass the company proxy; its secure requests then get out instead of timing out.
- Live connections through a proxy: A chat or live-update feature that uses WebSockets keeps working when the server sits behind a proxy.
- Proxies that need a login: Put the user name and password into the proxy address, or answer a company Kerberos login with the built-in option.
- Extra headers for the proxy: Some proxies want a team or tracing header on each tunnel; the agent sends it only to the proxy, not to the destination site.
- Calls from one fixed address: A partner service only accepts calls from addresses on its allow list; your app sends those calls through your own proxy with a fixed address. (idea, not from the official pages)
- Log which proxy was used: When requests fail on some machines, the request reports which proxy it went through, so the logs show the cause.

### How to start
- Add the package to your Node.js project (Node.js 20 or newer for version 9; it ships as an ES module).

```
npm install https-proxy-agent
```

- Create one agent with your proxy address and pass it to each request as the agent option.

```
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent('http://168.63.76.32:3128');
```


### License
Free to use, also in paid and closed-source products, under the MIT license. Keep the copyright and license notice when you pass its files on.

### Good to know
- It does not read proxy settings from the environment by itself; you pass the address. The project points most people to its proxy-agent package for that.
- It plugs into Node's https and ws style requests through their agent option. The fetch() built into Node.js is a different engine and needs undici's proxy tools instead.
- Version 8 switched to ES modules and version 9 needs Node.js 20 or newer.
- The proxy sees which sites your app connects to; the content of secure connections stays encrypted inside the tunnel.

Checked 2026-11-10 against: https://github.com/TooTallNate/proxy-agents/blob/main/README.md, https://github.com/TooTallNate/proxy-agents/blob/main/packages/https-proxy-agent/README.md, https://github.com/TooTallNate/proxy-agents/blob/main/packages/https-proxy-agent/CHANGELOG.md, https://github.com/TooTallNate/proxy-agents/blob/main/packages/https-proxy-agent/LICENSE, https://github.com/TooTallNate/proxy-agents/blob/main/packages/https-proxy-agent/package.json, https://github.com/TooTallNate/proxy-agents/blob/main/packages/proxy-agent/README.md, https://github.com/nodejs/undici/blob/main/README.md, https://github.com/nodejs/undici/blob/main/docs/docs/api/EnvHttpProxyAgent.md, https://registry.npmjs.org/https-proxy-agent, https://registry.npmjs.org/https-proxy-agent/9.1.0

### Mistakes to avoid
- Don't: new HttpsProxyAgent('http://168.63.76.32:3128') copied from the README example → Do: new HttpsProxyAgent(process.env.HTTPS_PROXY) with your own or your company's proxy (The address in the examples is a sample; sending your app's traffic through an unknown proxy exposes which sites it calls and any proxy login.)
- Don't: await fetch(url, { agent }) with Node's built-in fetch → Do: import { EnvHttpProxyAgent, setGlobalDispatcher } from 'undici'; setGlobalDispatcher(new EnvHttpProxyAgent()) (Node's fetch runs on undici, which routes requests through dispatchers, not through an agent option.)
- Don't: Expecting HTTPS_PROXY and NO_PROXY to be honoured automatically → Do: Pass the proxy URL yourself and skip local hosts in your code, or use proxy-agent / undici's EnvHttpProxyAgent (https-proxy-agent is the low-level piece; the env-variable handling lives in proxy-agent.)
- Don't: new HttpsProxyAgent({ host: 'myproxy', port: 1234, auth: 'user:pass' }) (5.x style) → Do: new HttpsProxyAgent('http://user:pass@myproxy:1234', { timeout: 1000 }) (Version 6 split the constructor into a URL plus an options object.)
- Don't: const { HttpsProxyAgent } = require('https-proxy-agent') on Node.js 18 → Do: Run Node.js 20+ and use import { HttpsProxyAgent } from 'https-proxy-agent', or stay on 7.0.x for old setups (Version 8 moved to ES modules and version 9 raised the minimum to Node.js 20.)

### Questions
- Does it pick up HTTPS_PROXY from the environment? No. Read the variable yourself and pass it in, or use the project's proxy-agent package, which follows the proxy environment variables.
- Does it work with fetch()? Not with the fetch() built into Node.js, which runs on undici; use undici's EnvHttpProxyAgent or ProxyAgent there.
- My old code passes an object like { host, port, auth } and now fails. Why? Since version 6 the constructor takes the proxy URL as the first argument and other options as a second one.
- Can it log in to a proxy that asks for a password? Yes. Put the user and password in the proxy URL, or for Kerberos proxies use the negotiate option added in 9.1.0.
- Is it still maintained? Yes. Version 9.1.0 came out on 2026-06-08 with new login and logging features.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
