Express middleware to proxy HTTP requests to another host and pass the response back. Current stable version is 2.0.3, targeting Node 16, 18, 20. Supports streaming, Promises, and customizable request/response transforms via decorators. Key differentiators: simple API with memoizable host selection, path resolution, and body decoration; streaming by default with automatic fallback to buffering when response modifiers are used.
npm install express-http-proxy-cpVerified import paths — ran on the pinned version, not inferred.
Basic proxy setup with path resolution and response transformation.
Upgrade Node to version 6 or higher; if stuck on older Node, use v1.x.
Avoid response modifiers for large payloads, or accept buffering overhead.
Replace userResDecorator with proxyResDecorator.
Reorder middleware: app.use('/proxy', proxy(...)) before app.use(bodyParser...). If unavoidable, set parseReqBody: false and use proxyReqBodyDecorator.Set proxyReqPathResolver function to construct the full path including query string.
Run npm install express-http-proxy --save
Use const proxy = require('express-http-proxy') or import proxy from 'express-http-proxy'Kill process using port 3000 or choose another port.
Define function as (req) => { ... } and use req.url if available.No dependency data recorded yet.