Registry / http-networking / node-http-proxy

node-http-proxy

JSON →
library0.2.4jsnpmunverified

This package, `node-http-proxy` by 'wddqing', provides an HTTP(S) proxy server for Node.js, distinguished by its support for both single and multi-process modes, configurable via a command-line interface (`nproxy`) or programmatic API. It was last published as version 0.2.4 over five years ago and requires a very old Node.js environment (>=0.10). The package is considered abandoned, lacks active maintenance, and is not compatible with modern Node.js versions or current web standards. It should not be confused with the widely-used and actively maintained `http-proxy` library from `http-party`, which offers a different API and feature set. Due to its age and lack of updates, using this specific `node-http-proxy` in contemporary projects poses significant compatibility and security risks.

npm install node-http-proxy
INSTALL
IMPORT
SIG · NODE-HTTP-PROXY
N
node-http-proxy
http-networkingjavascriptv0.2.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ProxyMaster
const { proxyMaster: ProxyMaster } = require('node-http-proxy');
import { ProxyMaster } from 'node-http-proxy';
This package uses CommonJS (CJS) modules exclusively due to its age. ES Modules (ESM) syntax like `import` will not work. The export `proxyMaster` is nested within the main module object.
nproxy CLI
npm install -g node-http-proxy && nproxy start -p 9999 -i 1
node node_modules/node-http-proxy/bin/nproxy.js start
The primary CLI entry point `nproxy` is available after global installation. Direct execution might require specific paths.

Demonstrates how to programmatically start a `node-http-proxy` server with a configurable port and number of worker instances.

const { proxyMaster: ProxyMaster } = require('node-http-proxy'); const port = process.env.PROXY_PORT ? parseInt(process.env.PROXY_PORT) : 8123; const instances = process.env.PROXY_INSTANCES ? parseInt(process.env.PROXY_INSTANCES) : 1; console.log(`Starting Node HTTP Proxy on port ${port} with ${instances} instance(s)...`); const proxymaster = new ProxyMaster({ instance: instances, port: port }); proxymaster.start(); // Example of how to stop the server (optional, for demonstration) // setTimeout(() => { // console.log('Stopping proxy master...'); // // Note: The original package's stop mechanism is primarily CLI-driven. // // Programmatic stopping might require deeper inspection or process killing. // }, 10000); console.log('Proxy server initialized. Use `curl -x 127.0.0.1:' + port + ' http://www.google.com/` to test.');
nproxy --version
Debug
Known issues
breakingThis package is extremely old (v0.2.4) and abandoned. It is fundamentally incompatible with modern Node.js versions (e.g., Node.js 12+), which have deprecated or removed features it relies on, such as old OpenSSL versions or specific internal Node.js APIs. Running it will likely result in runtime errors.
fix
Do not use this package. Consider modern alternatives like `http-proxy` (from `http-party`) or `http-proxy-middleware`.
affects: >=0.2.4 (all versions)
gotchaThis specific `node-http-proxy` (by 'wddqing') is distinct from the popular and actively maintained `http-proxy` (by `http-party`). Using this abandoned version will lead to compatibility, security, and maintenance issues. Always verify the GitHub repository and npm publisher for proxy libraries.
fix
Ensure you are installing and using `http-proxy` from the `http-party` organization (npm: `http-proxy`) if you need a current, maintained proxy library. If you need a middleware for Express/Connect, `http-proxy-middleware` is also an excellent choice.
affects: >=0.2.4 (all versions)
breakingDue to its age and reliance on CommonJS, this package will not work directly in Node.js ES Module environments without a CommonJS wrapper or specific build configurations (e.g., using `createRequire`).
fix
If forced to use this package in an ESM context (not recommended), you would need to use `import { createRequire } from 'module'; const require = createRequire(import.meta.url);` before your `require()` calls. However, overall compatibility issues remain. Prioritize migration to a modern proxy solution.
affects: >=0.2.4 (all versions)
gotchaThe package's lack of maintenance implies potential unfixed security vulnerabilities. Using it in production could expose your application to risks such as proxy-related attacks, denial of service, or data breaches.
fix
Migrate to a actively maintained HTTP proxy library that receives regular security updates and patches. This package should not be used in any security-sensitive environment.
affects: >=0.2.4 (all versions)
Errors
Common errors & fixes
ReferenceError: require is not defined in ES module scope
Attempting to use `require()` syntax in a Node.js environment configured for ES Modules (e.g., `"type": "module"` in package.json).
fix
This package is strictly CommonJS. Change your project to CommonJS (remove `"type": "module"` from `package.json`) or use `createRequire` for interoperability (not recommended for an abandoned package).
Error: listen EADDRINUSE: address already in use :::8123
The specified proxy port (default 8123) is already being used by another application on your system.
fix
Stop the application using the port or configure `node-http-proxy` to use a different port (e.g., `new ProxyMaster({port: 9000})`).
Error: The "url" argument must be of type string. Received undefined
An upstream proxy request or configuration is missing a target URL, which might stem from outdated internal dependencies or misconfigurations for HTTP client interactions within the proxy.
fix
This error often indicates deep incompatibility with modern Node.js `http` modules or internal issues within this specific, old package. There's no straightforward fix; it reinforces the recommendation to migrate to a maintained proxy library.
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies
commanderrequiredUsed for command-line interface parsing (`nproxy`).
bufferhelperrequiredLikely used for buffering HTTP stream data.
requestrequiredA very common HTTP client library at the time, likely used for making upstream proxy requests.
pmrequiredPotentially used for process management in multi-process mode.
Agent activity
4 hits · last 30 days
node
4
Resources