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.
npm install express-request-proxyVerified import paths — ran on the pinned version, not inferred.
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.
Migrate to a modern proxy solution based on 'node-fetch', 'axios', 'undici', or 'http-proxy-middleware'.
Use 'const requestProxy = require("express-request-proxy");' for importing the middleware.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.Define environment variables in your deployment environment or use a package like 'dotenv' to load them before your application script runs.
Consider migrating to a contemporary proxy solution that uses modern HTTP clients for better maintainability and performance.
Change your import statement to CommonJS: 'const requestProxy = require("express-request-proxy");'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.
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.
Ensure the 'url' option is always provided in the 'requestProxy' configuration object, as it is the only required option.