This package, `http-proxy-node16`, currently at version 1.0.6, is a specialized fork of the popular `node-http-proxy` library. Its primary purpose is to ensure robust compatibility and functionality within Node.js environments version 16.x and later, explicitly addressing potential breaking changes, deprecations, or compatibility issues that might arise when using the original `http-proxy` on newer Node.js runtimes. It offers comprehensive programmable HTTP and WebSocket proxying capabilities, making it an ideal choice for implementing components such as reverse proxies, sophisticated load balancers, or custom HTTP proxy middleware. A key differentiator from the upstream `node-http-proxy` is its explicit focus and testing against Node.js v16 and beyond, providing a reliable solution for applications deployed in these modern environments. The project indicates a maintenance approach welcoming "bug-fix PRs," suggesting a reactive, community-driven cadence for updates. This fork serves as a targeted solution for developers seeking a stable proxying library specifically for their Node.js 16+ applications, where the original project might have broader compatibility concerns or different priorities.
npm install http-proxy-node16Verified import paths — ran on the pinned version, not inferred.
Sets up a basic stand-alone proxy server on port 8000 that forwards all HTTP requests to a target server running on port 9000, demonstrating core proxying functionality and basic error handling.
Ensure your Node.js environment is at least v16.x for guaranteed compatibility and stability with this fork.
Always attach an error handler using `proxy.on('error', (err, req, res) => { ... })` or by providing an error callback to `proxy.web(req, res, options, (err) => { ... })` to gracefully manage proxying failures.Monitor the GitHub repositories of both `http-proxy-node16` and `node-http-proxy` to stay informed about updates and assess which project best meets your security and feature requirements.
Instead of `proxy.listen(8000)`, consider `const server = http.createServer((req, res) => proxy.web(req, res, { target: '...' })); server.listen(8000);` for greater control.Ensure the target server process is started and listening on the specified host and port before the proxy attempts to forward requests to it. Check firewall rules if the target is remote.
Provide a complete target URL string including protocol, host, and port (e.g., `{ target: 'http://localhost:3000' }`) in the proxy options.Ensure the target server is capable of handling WebSocket connections and has an `upgrade` event listener or uses a library (like `ws` or `socket.io`) that manages WebSocket upgrades correctly.
No dependency data recorded yet.