{"id":17226,"library":"express-request-proxy","title":"Express Request Proxy","description":"express-request-proxy is an Express.js middleware designed for creating high-performance streaming HTTP reverse proxies. It enables features like transparent caching via Redis, server-side injection of sensitive API keys and headers, custom route parameter handling, and response transformations. The package is built upon the widely used, but now deprecated, `request` HTTP client library. Its last major release was 2.x, with version 2.2.2 being the latest. Given its dependency on the unmaintained `request` library and lack of recent updates (last commit August 2018), the package is effectively abandoned, limiting its viability for new projects and posing potential maintenance and security risks.","status":"abandoned","version":"2.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/dvonlehman/express-request-proxy","tags":["javascript","express","middleware","request","api","proxy"],"install":[{"cmd":"npm install express-request-proxy","lang":"bash","label":"npm"},{"cmd":"yarn add express-request-proxy","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-request-proxy","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP client for proxying. This library is officially deprecated and unmaintained, making express-request-proxy inherit its security and stability issues.","package":"request","optional":false},{"reason":"Required for enabling the caching functionality within the proxy middleware.","package":"redis","optional":true},{"reason":"Extends the node_redis client with stream-based functionality essential for express-request-proxy's caching mechanism.","package":"redis-streams","optional":true}],"imports":[{"note":"This package is CommonJS only and relies on the deprecated 'request' library. Attempting ES module imports will result in errors. There are no named exports.","wrong":"import requestProxy from 'express-request-proxy';","symbol":"requestProxy","correct":"const requestProxy = require('express-request-proxy');"}],"quickstart":{"code":"const express = require('express');\nconst redis = require('redis');\nconst requestProxy = require('express-request-proxy');\nrequire('redis-streams')(redis); // Extend redis client with streams functionality\n\nconst app = express();\nconst port = 3000;\n\n// Create a Redis client for caching\nconst redisClient = redis.createClient();\nredisClient.on('error', (err) => console.error('Redis Client Error', err));\n\n// Connect to Redis (async operation)\nasync function connectRedis() {\n  await redisClient.connect();\n  console.log('Connected to Redis');\n}\nconnectRedis();\n\napp.get(\n  '/api/:resource/:id',\n  requestProxy({\n    cache: redisClient, // Use the connected Redis client\n    cacheMaxAge: 60, // Cache for 60 seconds\n    url: 'https://jsonplaceholder.typicode.com/:resource/:id', // Example public API\n    query: {\n      api_key: process.env.SOMEAPI_SECRET_KEY ?? 'demo-key' // Inject sensitive key from env\n    },\n    headers: {\n      'X-Custom-Auth': process.env.SOMEAPI_CUSTOM_HEADER ?? 'secret-value' // Inject custom header\n    }\n  })\n);\n\napp.get('/', (req, res) => {\n    res.send('Proxy server running. Try /api/posts/1 or /api/users/2');\n});\n\napp.listen(port, () => {\n  console.log(`Proxy server listening at http://localhost:${port}`);\n  console.log('Test with: curl http://localhost:3000/api/posts/1');\n});","lang":"javascript","description":"This quickstart demonstrates setting up an Express server to use `express-request-proxy` to forward requests to a public API, including server-side injection of API keys and custom headers, and utilizing Redis for caching responses."},"warnings":[{"fix":"Migrate to a modern proxy solution based on 'node-fetch', 'axios', 'undici', or 'http-proxy-middleware'.","message":"The core dependency, 'request' library, has been officially deprecated and is no longer maintained. This means 'express-request-proxy' inherits significant security vulnerabilities, stability issues, and lack of future updates. Using this package in production is highly discouraged.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use 'const requestProxy = require(\"express-request-proxy\");' for importing the middleware.","message":"This package is CommonJS (CJS) only. Attempting to import it using ES module syntax (e.g., 'import requestProxy from \"express-request-proxy\"') will lead to runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you call 'require(\"redis-streams\")(redis);' after requiring the 'redis' package and before creating the client used by the proxy. Also ensure the redis client is connected before passing it.","message":"The caching feature relies on a 'redis' client that must be extended with 'redis-streams'. Incorrect setup (e.g., missing 'require(\"redis-streams\")(redis);') will prevent caching from working or cause runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Define environment variables in your deployment environment or use a package like 'dotenv' to load them before your application script runs.","message":"Environment variables for sensitive keys (e.g., 'SOMEAPI_SECRET_KEY') must be set in the server environment before the application starts, as 'express-request-proxy' accesses them directly via 'process.env'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to a contemporary proxy solution that uses modern HTTP clients for better maintainability and performance.","message":"The 'request' library, which this package is built upon, is deprecated. Its API patterns (e.g., callback-based) are outdated compared to modern promise-based or async/await HTTP clients, affecting code maintainability and future compatibility.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2':67 '2.2.2':71 '2018':91 'abandon':96 'api':36,114 'august':90 'built':50 'cach':27 'client':60 'commit':89 'creat':14 'custom':40 'depend':77 'deprec':57 'design':12 'effect':95 'enabl':23 'express':1,5,111 'express-request-proxi':4 'express.js':10 'featur':24 'given':75 'handl':43 'header':39 'high':16 'high-perform':15 'http':19,59 'inject':33 'javascript':110 'key':37 'lack':84 'last':63,88 'latest':74 'librari':61,82 'like':25 'limit':97 'mainten':106 'major':64 'middlewar':11,112 'new':101 'packag':48,93 'paramet':42 'perform':17 'pose':104 'potenti':105 'project':102 'proxi':3,7,21,115 'recent':86 'redi':29 'releas':65 'request':2,6,58,81,113 'respons':45 'revers':20 'risk':109 'rout':41 'secur':108 'sensit':35 'server':31 'server-sid':30 'side':32 'stream':18 'transform':46 'transpar':26 'unmaintain':80 'updat':87 'upon':51 'use':54 'version':70 'via':28 'viabil':99 'wide':53 'x':68","created_at":"2026-04-22T16:30:18.923093+00:00","updated_at":"2026-04-22T16:30:18.923093+00:00","problems":[{"fix":"Change your import statement to CommonJS: 'const requestProxy = require(\"express-request-proxy\");'","cause":"Attempting to use ES module import syntax (e.g., 'import') for a CommonJS-only package.","error":"TypeError: requestProxy is not a function"},{"fix":"Ensure 'request' is listed in your package.json and installed. However, due to its deprecation, it's strongly recommended to migrate away from this package.","cause":"The 'request' dependency might be missing, or there are module resolution issues related to its deprecation and potential removal from package managers.","error":"Error: Cannot find module 'request'"},{"fix":"Verify your Redis server is running and configured correctly. Check the host and port in 'redis.createClient()' options, and ensure `redisClient.connect()` has been called and awaited.","cause":"The Redis server is not running or is inaccessible at the configured host/port, or the client was not connected before being passed to the proxy.","error":"Redis Client Error connect ECONNREFUSED"},{"fix":"Ensure the 'url' option is always provided in the 'requestProxy' configuration object, as it is the only required option.","cause":"The configuration object passed to 'requestProxy' is invalid or incomplete, preventing it from returning a valid Express middleware function. Most commonly, the 'url' option is missing.","error":"TypeError: app.use() requires middleware functions but got a [object Object]"}],"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/dvonlehman/express-request-proxy","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/express-request-proxy","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-21","install_tag":null}}