{"id":16460,"library":"node-http-proxy","title":"Node.js Process-Based HTTP Proxy","description":"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.","status":"abandoned","version":"0.2.4","language":"javascript","source_language":"en","source_url":"https://github.com/wddqing/node-http-proxy","tags":["javascript","node-http-proxy","http-proxy","proxy","bufferhelper","pm","request","commander"],"install":[{"cmd":"npm install node-http-proxy","lang":"bash","label":"npm"},{"cmd":"yarn add node-http-proxy","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-http-proxy","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for command-line interface parsing (`nproxy`).","package":"commander","optional":false},{"reason":"Likely used for buffering HTTP stream data.","package":"bufferhelper","optional":false},{"reason":"A very common HTTP client library at the time, likely used for making upstream proxy requests.","package":"request","optional":false},{"reason":"Potentially used for process management in multi-process mode.","package":"pm","optional":false}],"imports":[{"note":"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.","wrong":"import { ProxyMaster } from 'node-http-proxy';","symbol":"ProxyMaster","correct":"const { proxyMaster: ProxyMaster } = require('node-http-proxy');"},{"note":"The primary CLI entry point `nproxy` is available after global installation. Direct execution might require specific paths.","wrong":"node node_modules/node-http-proxy/bin/nproxy.js start","symbol":"nproxy CLI","correct":"npm install -g node-http-proxy && nproxy start -p 9999 -i 1"}],"quickstart":{"code":"const { proxyMaster: ProxyMaster } = require('node-http-proxy');\n\nconst port = process.env.PROXY_PORT ? parseInt(process.env.PROXY_PORT) : 8123;\nconst instances = process.env.PROXY_INSTANCES ? parseInt(process.env.PROXY_INSTANCES) : 1;\n\nconsole.log(`Starting Node HTTP Proxy on port ${port} with ${instances} instance(s)...`);\n\nconst proxymaster = new ProxyMaster({\n  instance: instances,\n  port: port\n});\n\nproxymaster.start();\n\n// Example of how to stop the server (optional, for demonstration)\n// setTimeout(() => {\n//   console.log('Stopping proxy master...');\n//   // Note: The original package's stop mechanism is primarily CLI-driven.\n//   // Programmatic stopping might require deeper inspection or process killing.\n// }, 10000);\n\nconsole.log('Proxy server initialized. Use `curl -x 127.0.0.1:' + port + ' http://www.google.com/` to test.');","lang":"javascript","description":"Demonstrates how to programmatically start a `node-http-proxy` server with a configurable port and number of worker instances."},"warnings":[{"fix":"Do not use this package. Consider modern alternatives like `http-proxy` (from `http-party`) or `http-proxy-middleware`.","message":"This 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.","severity":"breaking","affected_versions":">=0.2.4 (all versions)"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=0.2.4 (all versions)"},{"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.","message":"Due 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`).","severity":"breaking","affected_versions":">=0.2.4 (all versions)"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=0.2.4 (all versions)"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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).","cause":"Attempting to use `require()` syntax in a Node.js environment configured for ES Modules (e.g., `\"type\": \"module\"` in package.json).","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Stop the application using the port or configure `node-http-proxy` to use a different port (e.g., `new ProxyMaster({port: 9000})`).","cause":"The specified proxy port (default 8123) is already being used by another application on your system.","error":"Error: listen EADDRINUSE: address already in use :::8123"},{"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.","cause":"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.","error":"Error: The \"url\" argument must be of type string. Received undefined"}],"ecosystem":"npm"}