node-http-proxy is an HTTP programmable proxying library that supports websockets and is suitable for implementing components such as reverse proxies and load balancers.
The tool addresses the need to intercept and forward HTTP requests between clients and target servers. It works by creating a proxy server instance through a createProxyServer call, which returns methods for proxying regular HTTP requests, WebSocket requests, and managing the server lifecycle. Requests flow through two pipelines—an incoming pipeline that manipulates the client-to-target stream and an outgoing pipeline that handles the target-to-client response stream. The library exposes both an Event Emitter API and a callback API for error handling, allowing developers to listen for proxy events and react to them programmatically.
Developers should choose this tool when building reverse proxies, load balancers, or other request-forwarding infrastructure in Node.js. It suits projects that need to modify request headers, rewrite responses, or handle WebSocket connections alongside standard HTTP traffic. The library can be used either as a standalone proxy server by invoking its listen method or integrated into existing HTTP servers for custom routing logic. HTTPS proxying is supported, and the tool provides options for configuring behavior across different proxy scenarios.
The project maintains active test coverage and demonstrates consistent development attention to code quality and reliability.