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
muslnode 18–226 runs
build_error
glibcnode 18–226 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.fixDo 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.fixEnsure 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`).fixIf 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.fixMigrate 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).
fixThis 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.
fixStop 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.
fixThis 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.
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.