Skip to content

Commit 7e5f891

Browse files
author
vhess
committed
Merge branch 'main' of https://github.com/sagemathinc/http-proxy-3 into http2-incoming
2 parents ddf7f05 + ce8f922 commit 7e5f891

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ Contributors:
2727

2828
**Status:**
2929

30-
August 21, 2025 STATUS compared to [http-proxy](https://www.npmjs.com/package/http-proxy) and [httpxy](https://www.npmjs.com/package/httpxy):
30+
October 8, 2025 STATUS compared to [http-proxy](https://www.npmjs.com/package/http-proxy) and [httpxy](https://www.npmjs.com/package/httpxy):
3131

3232
- Library entirely rewritten in Typescript in a modern style, with many typings added internally and strict mode enabled.
3333
- **HTTP/2 Support**: Full HTTP/2 support via fetch API with callback-based request/response lifecycle hooks.
3434
- All dependent packages updated to latest versions, addressing all security vulnerabilities according to `pnpm audit`.
3535
- Code rewritten to not use deprecated/insecure API's, e.g., using `URL` instead of `parse`.
36-
- 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. Also fixed an issue with uncatchable errors when using websockets.
36+
- Fixed multiple 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. Also fixed an issue with uncatchable errors when using websockets.
3737
- Switch to pnpm for development.
3838
- 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.
39+
- [Partial HTTP2 support](https://github.com/sagemathinc/http-proxy-3/pull/33).
3940
- Addressed [this vulnerability](https://github.com/http-party/node-http-proxy/issues/1647).
4041

4142
**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.

lib/http-proxy/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,10 @@ export function toURL(
335335
if (url.startsWith("//")) {
336336
// special case -- this would be viewed as a this is a "network-path reference",
337337
// so we explicitly prefix with our http schema. See
338-
url = `http://dummy.org${url}`;
338+
url = `http://base.invalid${url}`;
339339
}
340340
// urllib.Url is deprecated but we support it by converting to URL
341-
return new URL(url, "http://dummy.org");
341+
return new URL(url, "http://base.invalid");
342342
}
343343

344344
// vendor simplified version of https://www.npmjs.com/package/requires-port to

lib/test/http/reverse-proxy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("Reverse proxying -- create a server that...", () => {
2626
server = http
2727
.createServer((req, res) => {
2828
log("Receiving reverse proxy request for:", req.url);
29-
const urlObj = new URL(req.url ?? "", "http://dummy.org");
29+
const urlObj = new URL(req.url ?? "", "http://base.invalid");
3030
const target = urlObj.origin;
3131
proxy.web(req, res, { target, secure: false });
3232
})

lib/test/lib/http-proxy-common.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ describe("#setupOutgoing", () => {
298298
setupOutgoing(
299299
outgoing,
300300
{
301-
target: new URL("http://dummy.org/some-path?a=1&b=2"),
301+
target: new URL("http://base.invalid/some-path?a=1&b=2"),
302302
},
303303
{ url: "/src?s=1" },
304304
);
@@ -311,7 +311,7 @@ describe("#setupOutgoing", () => {
311311
setupOutgoing(
312312
outgoing,
313313
{
314-
target: new URL("http://dummy.org/some-path?a=1&b=2"),
314+
target: new URL("http://base.invalid/some-path?a=1&b=2"),
315315
ignorePath: true,
316316
},
317317
{ url: "/src?s=1" },
@@ -329,7 +329,7 @@ describe("#setupOutgoing", () => {
329329
setupOutgoing(
330330
outgoing,
331331
{
332-
target: new URL("http://sometarget.com:80", "http://dummy.org"),
332+
target: new URL("http://sometarget.com:80", "http://base.invalid"),
333333
toProxy: true,
334334
},
335335
{ url: google },
@@ -344,7 +344,7 @@ describe("#setupOutgoing", () => {
344344
setupOutgoing(
345345
outgoing,
346346
{
347-
target: new URL("http://sometarget.com:80", "http://dummy.org"),
347+
target: new URL("http://sometarget.com:80", "http://base.invalid"),
348348
toProxy: true,
349349
},
350350
{ url: google },
@@ -359,7 +359,7 @@ describe("#setupOutgoing", () => {
359359
setupOutgoing(
360360
outgoing,
361361
{
362-
target: new URL("http://sometarget.com:80", "http://dummy.org"),
362+
target: new URL("http://sometarget.com:80", "http://base.invalid"),
363363
toProxy: true,
364364
},
365365
{ url: google },
@@ -375,7 +375,7 @@ describe("#setupOutgoing", () => {
375375
setupOutgoing(
376376
outgoing,
377377
{
378-
target: new URL(myEndpoint, "http://dummy.org"),
378+
target: new URL(myEndpoint, "http://base.invalid"),
379379
ignorePath: true,
380380
},
381381
{ url: "/more/crazy/pathness" },
@@ -390,7 +390,7 @@ describe("#setupOutgoing", () => {
390390
setupOutgoing(
391391
outgoing,
392392
{
393-
target: new URL(myEndpoint, "http://dummy.org"),
393+
target: new URL(myEndpoint, "http://base.invalid"),
394394
ignorePath: true,
395395
prependPath: false,
396396
},
@@ -408,7 +408,7 @@ describe("#setupOutgoing", () => {
408408
setupOutgoing(
409409
outgoing,
410410
{
411-
target: new URL(myEndpoint, "http://dummy.org"),
411+
target: new URL(myEndpoint, "http://base.invalid"),
412412
changeOrigin: true,
413413
},
414414
{ url: "/" },
@@ -475,7 +475,7 @@ describe("#setupOutgoing", () => {
475475
setupOutgoing(
476476
outgoing,
477477
{
478-
target: new URL("https://whooooo.com", "http://dummy.org"),
478+
target: new URL("https://whooooo.com", "http://base.invalid"),
479479
method: "POST",
480480
},
481481
{ method: "GET", url: "" },

lib/test/lib/http-proxy-passes-web-incoming.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ describe("#followRedirects", () => {
691691
const source = http
692692
.createServer((req, res) => {
693693
if (
694-
new URL(req.url ?? "", "http://dummy.org").pathname === "/redirect"
694+
new URL(req.url ?? "", "http://base.invalid").pathname ===
695+
"/redirect"
695696
) {
696697
res.writeHead(200, { "Content-Type": "text/plain" });
697698
res.end("ok");

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.21.1",
3+
"version": "1.22.0",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/sagemathinc/http-proxy-3.git"

0 commit comments

Comments
 (0)