Skip to content

Releases: unjs/httpxy

v0.5.1

22 Apr 13:14
@pi0 pi0

Choose a tag to compare

compare changes

🚀 Enhancements

  • server: listeningCallback (#127)

🩹 Fixes

  • Use agents: false for ws upgrade (#129)
  • Do not set undefined values for headers (#130)

❤️ Contributors

v0.5.0

26 Mar 10:35
@pi0 pi0

Choose a tag to compare

Special thanks to @mcollina ❤️ Performance optimizations were inspired by analysis of fast-proxy and @fastify/http-proxy.

⚠️ Breaking: Default keep-alive connection pooling

ProxyServer and proxyFetch now use shared http.Agent / https.Agent instances with keepAlive: true (256 max sockets, 64 max free sockets) instead of creating a new socket per request. Set agent: false to restore previous per-request connection behavior.

Performance improvements

  • Default keep-alive agents — Connection reuse via shared agent pools for both ProxyServer and proxyFetch. HTTP/2 incoming requests are excluded to avoid stream lifecycle conflicts.
  • Streaming request bodies in proxyFetchReadableStream and Blob bodies are piped directly to upstream instead of buffering in memory. Bodies are still buffered when followRedirects is enabled for 307/308 replay.
  • Single-pass header mergesetupOutgoing merges req.headers and options.headers in one pass instead of two spread operations.
  • Raw header pairs for responseproxyFetch builds response headers from rawHeaders pairs instead of iterating a Headers object.
  • Plain-object header fast path — When init.headers is a plain Record, headers are merged with Object.assign instead of wrapping in Headers.

Bug fixes

  • Fix header merge regression preserving :authority → host override order for HTTP/2
  • Destroy outgoing request on readable body stream error in proxyFetch

Benchmarks

bench/bench.ts -s -d 60s -c 128

Duration: 60s | Connections: 128 | Mode: sequential

GET (no body)

Proxy Req/s Scale Avg P50 P99 Throughput
httpxy.server 19694 1.00x 6µs 5µs 33µs 3.6MB/s
fast-proxy 19664 1.00x 7µs 4µs 38µs 3.6MB/s
@fastify/http-proxy 18957 0.96x 7µs 4µs 44µs 3.5MB/s
httpxy.proxyFetch 15433 0.78x 8µs 6µs 34µs 2.8MB/s
http-proxy-3 13010 0.66x 10µs 10µs 13µs 2.0MB/s
http-proxy 12893 0.65x 10µs 10µs 13µs 2.0MB/s

POST (~1KB JSON)

Proxy Req/s Scale Avg P50 P99 Throughput
httpxy.server 17316 1.00x 7µs 6µs 31µs 20.6MB/s
fast-proxy 15365 0.89x 8µs 5µs 42µs 18.3MB/s
@fastify/http-proxy 15117 0.87x 8µs 5µs 47µs 18.1MB/s
httpxy.proxyFetch 13179 0.76x 10µs 7µs 41µs 15.7MB/s
http-proxy-3 11487 0.66x 11µs 11µs 15µs 13.4MB/s
http-proxy 11052 0.64x 12µs 11µs 14µs 12.9MB/s

v0.4.0

25 Mar 20:53
@pi0 pi0

Choose a tag to compare

compare changes

🚀 Enhancements

  • HTTP/2 listener support (#102)
  • fetch: Add proxyFetch options for timeout, xfwd, changeOrigin, agent, followRedirects, HTTPS, and path merging (efa9711)

🩹 Fixes

  • web-incoming: Close downstream stream when upstream SSE aborts (#103)
  • Handle relative Location URLs in redirect rewriting (#20, #104)
  • web-outgoing: Handle invalid response header characters gracefully (#106)
  • web-incoming: Remove deprecated req.abort() and req.on("aborted") (#107)
  • web-outgoing: Handle object target in redirect host rewrite (#108)
  • web-incoming: Remove deprecated req.on('aborted') listener (#110)
  • ws: Skip writing to closed socket on non-upgrade response (#114)
  • web-incoming: Guard req.socket access in error handler (#112)
  • web-incoming: Defer pipe until socket connects (#111)
  • server: Catch synchronous exceptions in middleware passes (#109)
  • web-incoming: Emit econnreset on client disconnect (#115)
  • ws: Handle response stream errors on failed WS upgrade (#116)
  • web-outgoing: Include HTTP 303 in redirect location rewriting (#119)
  • web-outgoing: Skip empty header names (#121)
  • ssl: Prevent undefined target values from overwriting ssl options (#118)
  • utils: Preserve target URL query string in path merging (#117)
  • middleware: Do not append duplicate x-forwarded-* header values (#120)
  • web-outgoing: Strip transfer-encoding on 204/304 (#122)
  • web-incoming: Use isSSL regex for consistent https/wss protocol checks (#123)
  • ws: Preserve wss:// protocol and fix error handling in proxyUpgrade (cb01605)

📦 Build

❤️ Contributors

v0.3.1

18 Feb 19:15
@pi0 pi0

Choose a tag to compare

compare changes

🚀 Enhancements

  • Standalone proxyUpgrade util (#100) (docs)

v0.3.0

12 Feb 22:54
@pi0 pi0

Choose a tag to compare

compare changes

🚀 Enhancements

  • proxyFetch (#98) (docs)
  • web-incoming: Implement native followRedirects support (d3d7f39)

🩹 Fixes

  • proxy: Ensure leading slash on toProxy outgoing path (7759c94)
  • server: Emit proxy error when listener exists, reject only when unhandled (c9d2c51)
  • web-incoming: Destroy request socket on timeout (40105be)
  • utils: Preserve multiple consecutive slashes in request URL (18e4d0d)
  • web-incoming: Abort proxy request when client disconnects (a5d4996)
  • ws: Handle client socket errors before upstream upgrade (aebb5c6)

💅 Refactors

  • Remove legacy node Url support (b2e6c92)

🏡 Chore

  • Enable strict typescript with nodenext resolution (0c147a3)

✅ Tests

🤖 CI

v0.2.2

11 Feb 17:23
@pi0 pi0

Choose a tag to compare

compare changes

📦 fixed build (thanks @SukkaW for notice ❤️)

v0.2.1

10 Feb 20:28
@pi0 pi0

Choose a tag to compare

compare changes

🌊 Types

  • Make httpxy's server event type map generic (#97)

❤️ Contributors

v0.2.0

09 Feb 11:00
@pi0 pi0

Choose a tag to compare

compare changes

💅 Refactors

  • ⚠️ Code improvements (#78)

🌊 Types

  • Implement typed proxy server event (#95, #96)

🏡 Chore

  • Migrate to oxfmt and oxlint (edd6cff)

✅ Tests

  • Port tests from node-http-proxy (#88)

❤️ Contributors

v0.1.7

27 Jan 17:17
@pi0 pi0

Choose a tag to compare

compare changes

🩹 Fixes

  • Preserve double slashes in url (#70)

❤️ Contributors

v0.1.6

14 Jan 13:26
@pi0 pi0

Choose a tag to compare

compare changes

🩹 Fixes

  • Omit outgoing port when not required (#65)

📖 Documentation

  • Remove unsupported followRedirects option (#66)
  • Improve example (#16)
  • Fix typo in readme (#36)

❤️ Contributors