httpxy is a performant and feature-rich HTTP and WebSocket proxy library for Node.js, currently at version `0.5.1`. It maintains an active release cadence with frequent minor and patch updates, as evidenced by recent versions like v0.5.1, v0.5.0, v0.4.0, and v0.3.0. The library offers three primary interfaces: `proxyFetch` for modern web-standard `Request`/`Response` based proxying, `proxyUpgrade` for standalone WebSocket upgrade handling without a full server instance, and `createProxyServer` which provides a more traditional, event-driven HTTP proxy server, originally forked from `node-http-proxy`. Key differentiators include its adoption of web-standard APIs, explicit WebSocket proxying capabilities, and performance optimizations inspired by libraries like `fast-proxy`. It ships with comprehensive TypeScript types, ensuring robust development in typed environments.
npm install httpxyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates setting up a basic HTTP proxy server using `createProxyServer`. It listens on a specified port and forwards incoming requests to a configurable target URL, handling potential proxy errors gracefully.
To revert to the pre-v0.5.0 behavior of creating a new socket per request, set `agent: false` in the options for `proxy.web` (e.g., `proxy.web(req, res, { target, agent: false })`) or `proxyFetch` (e.g., `proxyFetch(target, url, { agent: false })`).Thoroughly review your proxy configurations and test applications when upgrading from versions prior to v0.2.0. Consult the changelog for any subtle behavioral changes that might impact your specific use case, though no explicit API changes were documented.
When using `proxyFetch`, explicitly set the `followRedirects` option if automatic redirect following is desired. For `ProxyServer`, consult the latest documentation for the specific `followRedirects` behavior and its configuration, as defaults and availability might vary.
Verify that the target server (e.g., `http://127.0.0.1:8080` in examples) is actively running and listening on the correct host and port. Ensure network connectivity between the `httpxy` server and the target server.
Ensure the target server specified in `proxyUpgrade` is correctly configured to handle WebSocket upgrade requests and that no intermediate proxies or firewalls are interfering with the WebSocket handshake. Check server logs for errors related to WebSocket connections.
For `httpxy` versions >= v0.5.0, ensure that `agent: false` is *not* set in your `ProxyServer` or `proxyFetch` options if you intend to leverage the default keep-alive connection pooling. If more granular control is needed, provide a custom `http.Agent` or `https.Agent` instance configured with `keepAlive: true`.
No dependency data recorded yet.