proxy-middleware offers a basic HTTP(S) proxy capability designed as middleware for the Connect framework. It enables developers to configure specific URL paths that forward incoming requests to an alternate target URL, supporting both HTTP and HTTPS protocols. The package's latest stable version is 0.15.0. It integrates directly into the Connect framework, a popular Node.js web framework from an earlier era. Given its age (last updated in 2016), the package is effectively abandoned, meaning it receives no further updates, security patches, or feature enhancements. This significantly limits its utility and makes it unsuitable for new projects or production environments in modern Node.js ecosystems, which have moved towards more feature-rich and actively maintained alternatives like `http-proxy-middleware` or `node-http-proxy`.
npm install proxy-middlewareVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up a Connect server with `proxy-middleware` to forward requests from `/api` to a local target server running on port 9000.
Migrate to actively maintained proxy solutions such as `http-proxy-middleware` for Express/Connect or `node-http-proxy` for lower-level control, which support modern Node.js and frameworks.
Replace with a currently maintained and regularly updated proxy library. Regularly audit your dependencies for security vulnerabilities.
In modern Node.js, `new URL()` is the recommended alternative for URL parsing. However, direct replacement within this package's API is not straightforward; migration to a modern proxy library is the best long-term solution.
Must be used with `require()` in a CommonJS module. For projects using ES Modules, it is highly recommended to use a modern, ESM-compatible proxy middleware instead.
Ensure you are using `connect` for your application and correctly initializing it, e.g., `const connect = require('connect'); const app = connect();`. If using Express, you should use an Express-compatible proxy middleware like `http-proxy-middleware`.This package is CommonJS-only. If your project is ESM, you need to either use a modern, ESM-compatible proxy middleware or configure your build system/Node.js environment to treat the file as CommonJS.
Carefully check the `url.parse()` options, ensuring the `protocol`, `hostname`, and `pathname` are correctly specified for your target. Also, verify that the middleware's mount path in `app.use('/api', proxy(...))` matches the intended proxy route prefix for incoming requests.