# http-proxy-agent

> An HTTP(s) proxy `http.Agent` implementation for HTTP

Latest version **9.1.0** (published 2026-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install http-proxy-agent
pnpm add http-proxy-agent
yarn add http-proxy-agent
bun add http-proxy-agent
```

## Health

**Score 68/100 (B)** — status: active.

Positive: has types package; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.1.0 |
| Published | 2026-06-08 |
| First published | 2013-07-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/http-proxy-agent) |
| Module format | ESM |
| Node | >= 20 |
| Dependencies | 3 |
| Unpacked size | 17.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1165 |
| Author | Nathan Rajlich |
| Maintainers | tootallnate |
| Keywords | http, proxy, endpoint, agent |

## Links

- npm: https://www.npmjs.com/package/http-proxy-agent
- Repository: https://github.com/TooTallNate/proxy-agents
- Homepage: https://github.com/TooTallNate/proxy-agents#readme
- Issues: https://github.com/TooTallNate/proxy-agents/issues
- npm.io page: https://npm.io/package/http-proxy-agent

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [agent-base](https://npm.io/package/agent-base.md) 9.0.0
- [proxy-agent-negotiate](https://npm.io/package/proxy-agent-negotiate.md) 1.1.0

## Recent versions

- 9.1.0 (latest) — 2026-06-08
- 9.0.0 — 2026-04-01
- 8.0.0 — 2026-03-11
- 7.0.2 — 2024-02-15
- 7.0.1 — 2024-02-12
- 7.0.0 — 2023-05-25
- 6.1.1 — 2023-05-24
- 6.1.0 — 2023-05-18
- 6.0.1 — 2023-05-05
- 6.0.0 — 2023-05-04
- 5.0.0 — 2021-09-23
- 4.0.1 — 2020-02-08
- 4.0.0 — 2020-01-23
- 3.0.0 — 2019-12-10
- 2.1.0 — 2018-03-03
- … 13 more at https://npm.io/package/http-proxy-agent/versions

## README

http-proxy-agent
================
### An HTTP(s) proxy `http.Agent` implementation for HTTP

This module provides an `http.Agent` implementation that connects to a specified
HTTP or HTTPS proxy server, and can be used with the built-in `http` module.

__Note:__ For HTTP proxy usage with the `https` module, check out
[`https-proxy-agent`](../https-proxy-agent).


Example
-------

```ts
import * as http from 'http';
import { HttpProxyAgent } from 'http-proxy-agent';

const agent = new HttpProxyAgent('http://168.63.76.32:3128');

http.get('http://nodejs.org/api/', { agent }, (res) => {
  console.log('"response" event!', res.headers);
  res.pipe(process.stdout);
});
```

API
---

### new HttpProxyAgent(proxy: string | URL, options?: HttpProxyAgentOptions)

The `HttpProxyAgent` class implements an `http.Agent` subclass that connects
to the specified "HTTP(s) proxy server" in order to proxy HTTP requests.

The `proxy` argument is the URL for the proxy server.

The `options` argument accepts the usual `http.Agent` constructor options, and
some additional properties:

 * `headers` - Object containing additional headers to send to the proxy server
   in each request. This may also be a function that returns a headers object.
  
   **NOTE:** If your proxy does not strip these headers from the request, they
   will also be sent to the destination server.

---
_Source: https://npm.io/package/http-proxy-agent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
