Skip to content

Commit 373a00a

Browse files
committed
update the README
1 parent 95afeed commit 373a00a

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
node-version:
3434
- "20"
3535
- "22"
36-
- "24"
3736

3837
steps:
3938
- uses: actions/checkout@v4

README.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22

33
[![Build package and run tests](https://github.com/sagemathinc/http-proxy-3/actions/workflows/test.yml/badge.svg)](https://github.com/sagemathinc/http-proxy-3/actions/workflows/test.yml)
44

5-
**WARNING: DEFINITELY DO NOT USE THIS IN PRODUCTION YET. It is not ready.**
5+
**THIS IS READY TO USE IN PRODUCTION.**
66

7-
http\-proxy\-3 is a modern drop-in-replacement rewrite of
7+
http\-proxy\-3 is a modern API compatible rewrite of
88
[http\-proxy](https://github.com/http-party/node-http-proxy), the original nodejs
99
http proxy server. `http-proxy-3` is an HTTP programmable proxying library that
10-
supports http/https and websockets. It is suitable for implementing components
11-
such as reverse proxies and load balancers.
10+
supports http/https and websockets. It is also suitable for implementing components
11+
such as reverse proxies and load balancers. It's main strength is that you can combine application logic written in Javascript with a proxy server, unlike what
12+
can be done using nginx or haproxy.
1213

1314
**PR's welcome!**
1415

15-
May 7, 2025 STATUS compared to http-proxy:
16+
May 10, 2025 STATUS compared to [http-proxy](https://www.npmjs.com/package/http-proxy) and [httpxy](https://www.npmjs.com/package/httpxy):
1617

17-
- Library entirely rewritten in Typescript in a modern style, with many types added internally
18-
- All dependent packages updated to latest versions, addressing all known security vulnerabilities (according to `pnpm audit`).
18+
- Library entirely rewritten in Typescript in a modern style, with many typings added internally.
19+
- All dependent packages updated to latest versions, addressing all security vulnerabilities according to `pnpm audit`.
1920
- Code rewritten to not use deprecated/insecure API's, e.g., using `URL` instead of `parse`.
20-
- Fixed major socket leaks in the Websocket proxy code
21-
- Used heavily in production on https://CoCalc.com
21+
- Fixed socket leaks in the Websocket proxy code, going beyond [http-proxy-node16](https://www.npmjs.com/package/http-proxy-node16) to also instrument and logging socket counts.
2222
- Switch to pnpm for development.
23-
- Some jest unit tests: converted many examples into unit tests with automated testing that they actually work. http-proxy's unit tests just setup the examples in many cases, but didn't test that they actually work.
23+
- More jest unit tests than both http-proxy and httpxy: converted all the http-proxy examples into working unit tests that they actually work (http-proxy's unit tests just setup the examples in many cases, but didn't test that they actually work). Also httpxy seems to have almost no tests. These tests should make contributing PR's much easier.
24+
- Used in production on https://CoCalc.com
25+
- Addressed [this vulnerability](https://github.com/http-party/node-http-proxy/issues/1647).
2426

25-
Why the name? http-proxy-2 wasn't available on npmjs.
26-
27-
**Motivation:** http-proxy is one of the oldest and most famous nodejs modules, and it gets downloaded around 15 million times a week. Unfortunately, it is [unmaintained](https://github.com/http-party/node-http-proxy/issues/1687), it has significant leaks that [regularly crash production servers](https://github.com/jupyterhub/configurable-http-proxy/issues/434), and is written in ancient untyped Javascript that `npm audit` warns has security vulnerabilities. The maintainers have long since stopped responding, so there is no choice but to fork and start over. I just wanted to do my part to help maintain the open source ecosystem, hence this library. I hope you find it useful.
27+
**Motivation:** http-proxy is one of the oldest and most famous nodejs modules, and it gets downloaded around 15 million times a week, and I've loved using it for years. Unfortunately, it is [unmaintained](https://github.com/http-party/node-http-proxy/issues/1687), it has significant leaks that [regularly crash production servers](https://github.com/jupyterhub/configurable-http-proxy/issues/434), and is written in ancient untyped Javascript. The maintainers have long since stopped responding, so there is no choice but to fork and start over. I wanted to do my part to help maintain the open source ecosystem, hence this library. I hope you find it useful.
2828

2929
**Performance:**
3030

31-
I've been adding load tests to the unit tests in various places. Generally speaking on a local machine over localhost the penalty to using the proxy server is that **things take about twice as long**. That's not surprising because it's twice as much work being done all in the same language (with the same tools).
31+
I've been adding load tests to the unit tests in various places. Generally speaking on a local machine over localhost the penalty to using the proxy server is that **things take about twice as long**. That's not surprising because it's twice as much work being done.
3232

3333
**Related Projects:**
3434

35-
- https://github.com/unjs/httpxy: it has the same motivation as this project -- it's a modern maintained rewrite of http-proxy. It seems to have [very little unit testing](https://github.com/unjs/httpxy/tree/main/test), which may make it more difficult to contribute to in the longrun.
35+
- https://github.com/unjs/httpxy: it has the same motivation as this project -- it's a modern maintained rewrite of http-proxy. Unfortunately, it seems to have [very little unit testing](https://github.com/unjs/httpxy/tree/main/test). In http-proxy-3 (and the original http-proxy), there's an order of magnitude more unit test code than code in the actual library.
3636

3737
**Development:**
3838

@@ -52,7 +52,9 @@ pnpm tsc
5252

5353
and make changes to code under lib/.
5454

55-
Tested with nodejs versions 20 or higher.
55+
Tested with nodejs versions 20 and 22.
56+
57+
[![Build package and run tests](https://github.com/sagemathinc/http-proxy-3/actions/workflows/test.yml/badge.svg)](https://github.com/sagemathinc/http-proxy-3/actions/workflows/test.yml)
5658

5759
## User's Guide
5860

@@ -135,19 +137,19 @@ to the client.
135137

136138
### Use Cases
137139

140+
There are unit tested examples illustrating everything below in
141+
the tests subdirectory.
142+
138143
#### Setup a basic stand-alone proxy server
139144

140145
```js
141146
import * as http from "http";
142147
import { createProxyServer } from "http-proxy-3";
143-
//
148+
144149
// Create your proxy server and set the target in the options.
145-
//
146150
createProxyServer({ target: "http://localhost:9000" }).listen(8000); // See (†)
147151

148-
//
149152
// Create your target server
150-
//
151153
http
152154
.createServer((req, res) => {
153155
res.writeHead(200, { "Content-Type": "text/plain" });
@@ -161,7 +163,7 @@ http
161163
.listen(9000);
162164
```
163165

164-
Invoking listen(..) triggers the creation of a web server. Otherwise, just the proxy instance is created.
166+
Just like with the nodejs http module, invoking `listen(...)` triggers the creation of a web server. Otherwise, just the proxy instance is created, which is just a lightweight object with configuration. _If you call close on the proxy it is a no\-op unless you have called listen._
165167

166168
**[Back to top](#table-of-contents)**
167169

@@ -599,7 +601,7 @@ pnpm test
599601

600602
### Contributing and Issues
601603

602-
- Submit a PR! I want this project to be active again! Port ideas from https://github.com/http-party/node-http-proxy/pulls and https://github.com/http-party/node-http-proxy/issues
604+
- Submit a PR! I want this project to be active again! Port ideas from [https://github.com/http\-party/node\-http\-proxy/pulls](https://github.com/http-party/node-http-proxy/pulls) and [https://github.com/http\-party/node\-http\-proxy/issues](https://github.com/http-party/node-http-proxy/issues). Email me at [[email protected]](mailto:[email protected]).
603605

604606
**[Back to top](#table-of-contents)**
605607

@@ -626,3 +628,4 @@ pnpm test
626628
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
627629
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
628630
> THE SOFTWARE.
631+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-proxy-3",
3-
"version": "1.19.12",
3+
"version": "1.20.0",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/sagemathinc/http-proxy-3.git"

0 commit comments

Comments
 (0)