You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- this required switching to node-fetch for a lot of tests
- a very small number of tests are disabled with node 18
- add to github CI
- script to automate testing locally on all platforms (if you have nvm
setup)
Copy file name to clipboardExpand all lines: README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ can be done using nginx or haproxy.
13
13
14
14
**PR's welcome!**
15
15
16
-
May 10, 2025 STATUS compared to [http-proxy](https://www.npmjs.com/package/http-proxy) and [httpxy](https://www.npmjs.com/package/httpxy):
16
+
May 11, 2025 STATUS compared to [http-proxy](https://www.npmjs.com/package/http-proxy) and [httpxy](https://www.npmjs.com/package/httpxy):
17
17
18
18
- Library entirely rewritten in Typescript in a modern style, with many typings added internally.
19
19
- All dependent packages updated to latest versions, addressing all security vulnerabilities according to `pnpm audit`.
@@ -34,6 +34,12 @@ I've been adding load tests to the unit tests in various places. Generally speak
34
34
35
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.
36
36
37
+
**Officially supported platforms:**
38
+
39
+
We run GitHUB CI on the following:
40
+
41
+
- nodejs versions 18, 20, 22, and 24
42
+
37
43
**Development:**
38
44
39
45
```sh
@@ -52,8 +58,6 @@ pnpm tsc
52
58
53
59
and make changes to code under lib/.
54
60
55
-
Tested with nodejs versions 20 and 22.
56
-
57
61
[](https://github.com/sagemathinc/http-proxy-3/actions/workflows/test.yml)
58
62
59
63
## User's Guide
@@ -601,7 +605,7 @@ pnpm test
601
605
602
606
### Contributing and Issues
603
607
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]).
608
+
- 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]).
"test-all": "pnpm audit && TEST_EXTERNAL_REVERSE_PROXY=yes pnpm test --runInBand",
50
+
"test-versions": ". \"$NVM_DIR/nvm.sh\" && nvm use 18 && pnpm test && nvm use 20 && pnpm test && nvm use 22 && pnpm test && nvm use 24 && pnpm test && nvm use 20",
A note about ports. These tests use a large number of ports and are run in
2
6
parallel. There will sometimes be failures sometimes due to a port conflict
3
7
between different tests being run at the same time.
@@ -6,4 +10,41 @@ Use `pnpm test --runInBand` to avoid this by running the tests in serial. This
6
10
is good for CI and release testing. Just use `pnpm test` for dev, since it's
7
11
much faster.
8
12
9
-
Another issue is that sometimes tests that proxy google.com will get rejected by Google due to anti-abuse by them. If you set the environment variable GITHUB_ACTIONS then those tests are not run.
13
+
## Reverse Proxy test
14
+
15
+
There are a few unit tests that involve a reverse proxy of google.com. These will often fail due to Google rejecting these robotic requests, so they are not run unless you
16
+
set this environment variable:
17
+
18
+
```sh
19
+
TEST_EXTERNAL_REVERSE_PROXY=yes
20
+
```
21
+
22
+
I run these manually before making a release, but not as part of CI. Use
23
+
24
+
```sh
25
+
pnpm test-all
26
+
```
27
+
to include these tests and also pnpm audit.
28
+
29
+
## fetch
30
+
31
+
We use
32
+
33
+
```
34
+
import fetch from "node-fetch";
35
+
```
36
+
37
+
in the unit tests instead of the fetch builtin to nodejs, since in node 18 the builtin fetch leaves an open handling hanging the test suite.
38
+
39
+
An exception is blacklist-headers.test.ts, where we can't even run the test using node-fetch, since it blocks it.
40
+
41
+
In particular, it is not acceptable for the test suite to exit with: _"A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them."_
42
+
43
+
## WARNINGS
44
+
45
+
These warnings in the test suite are expected, because we're testing ssl using self signed certs:
46
+
47
+
```
48
+
(node:52812) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
49
+
(Use `node --trace-warnings ...` to show where the warning was created)
0 commit comments