{"id":18335,"library":"express-http-proxy-cp","title":"express-http-proxy","description":"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.","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":"git://github.com/villadora/express-http-proxy","tags":["javascript","express-http-proxy"],"install":[{"cmd":"npm install express-http-proxy-cp","lang":"bash","label":"npm"},{"cmd":"yarn add express-http-proxy-cp","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-http-proxy-cp","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only; use default import or const proxy = require('express-http-proxy')","wrong":"const { proxy } = require('express-http-proxy')","symbol":"proxy","correct":"import proxy from 'express-http-proxy'"},{"note":"proxy() returns middleware; do not invoke the result.","wrong":"app.use('/proxy', proxy('http://example.com'))()","symbol":"proxy (function)","correct":"app.use('/proxy', proxy('http://example.com'))"},{"note":"Option property names are camelCase. Common misspelling: 'proxyReqOptionsDecorator' instead of 'proxyReqOptDecorator'.","wrong":"app.use('/proxy', proxy('host', { proxyReqOptionsDecorator: (req) => req }))","symbol":"options","correct":"app.use('/proxy', proxy('host', { proxyReqOptDecorator: (req) => req }))"}],"quickstart":{"code":"const express = require('express');\nconst proxy = require('express-http-proxy');\nconst app = express();\n\napp.use('/proxy', proxy('http://httpbin.org', {\n  proxyReqPathResolver: (req) => '/anything' + req.url,\n  proxyResDecorator: (proxyRes, proxyResData, userReq, userRes) => {\n    const data = JSON.parse(proxyResData.toString('utf8'));\n    data.transformed = true;\n    return JSON.stringify(data);\n  }\n}));\n\napp.listen(3000, () => console.log('Proxy listening on port 3000'));","lang":"javascript","description":"Basic proxy setup with path resolution and response transformation."},"warnings":[{"fix":"Upgrade Node to version 6 or higher; if stuck on older Node, use v1.x.","message":"Requires Node >=6.0.0; breaking change for older Node versions","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Avoid response modifiers for large payloads, or accept buffering overhead.","message":"Streaming disabled when response modifiers (userResDecorator, userResHeaderDecorator) are used; request and response are buffered","severity":"gotcha","affected_versions":">=1.2.0"},{"fix":"Replace userResDecorator with proxyResDecorator.","message":"UserResDecorator and similar hooks are deprecated in favor of proxyResDecorator and proxyResHeaderDecorator","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Reorder middleware: app.use('/proxy', proxy(...)) before app.use(bodyParser...). If unavoidable, set parseReqBody: false and use proxyReqBodyDecorator.","message":"Body-parser must be registered AFTER the proxy middleware, or POST body may be mutated","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set proxyReqPathResolver function to construct the full path including query string.","message":"Host argument ignores path after host; use proxyReqPathResolver for full path control","severity":"gotcha","affected_versions":">=1.1.0"}],"env_vars":null,"search_vec":"'16':26 '18':27 '2.0.3':23 '20':28 'anoth':12 'api':41 'automat':55 'back':18 'bodi':49 'buffer':58 'current':19 'customiz':33 'decor':37,50 'default':53 'differenti':39 'express':2,5,66 'express-http-proxi':1,65 'fallback':56 'host':13,44 'http':3,9,67 'javascript':64 'key':38 'memoiz':43 'middlewar':6 'modifi':61 'node':25 'pass':15 'path':46 'promis':31 'proxi':4,8,68 'request':10 'request/response':34 'resolut':47 'respons':17,60 'select':45 'simpl':40 'stabl':20 'stream':30,51 'support':29 'target':24 'transform':35 'use':63 'version':21 'via':36","created_at":"2026-04-25T07:37:42.291155+00:00","updated_at":"2026-04-25T07:37:42.291155+00:00","problems":[{"fix":"Run npm install express-http-proxy --save","cause":"Package not installed.","error":"Cannot find module 'express-http-proxy'"},{"fix":"Use const proxy = require('express-http-proxy') or import proxy from 'express-http-proxy'","cause":"Wrong import: using named import instead of default.","error":"TypeError: proxy is not a function"},{"fix":"Kill process using port 3000 or choose another port.","cause":"Port already in use.","error":"Error: listen EADDRINUSE :::3000"},{"fix":"Define function as (req) => { ... } and use req.url if available.","cause":"proxyReqPathResolver called with wrong arguments; expects (req, res).","error":"Cannot read property 'url' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/villadora/express-http-proxy","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/express-http-proxy-cp","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}