
http-proxy-middleware
Node.js middleware that forwards HTTP requests from your server to another target, with simple configuration.
- Stars
- 11.1k
- Forks
- 878
- Licence
- MIT
- Language
- TypeScript
- Last update
- 5 days ago
- Type
- Library
What it is
http-proxy-middleware is a Node.js library that plugs into web servers such as Express or Connect and forwards incoming requests to another server, such as a backend API. It is commonly used during development so a frontend app can call an API on a different address without browser cross-origin problems. It is powered by httpxy, a maintained version of http-proxy.
- Forward /api requests from a frontend dev server to a backend at another address
- Rewrite URL paths before forwarding, for example removing a prefix
- Route requests to different targets based on host name or path using the router option
- Filter which requests get proxied with pathFilter
Great for
- Node.js developers running an Express, Connect, or Next.js dev server who need to forward /api requests to a backend
- Teams that want to rewrite paths or route requests to different targets based on host or path
- Developers who need WebSocket proxying alongside HTTP proxying
Not ideal for
- People who need a standalone reverse proxy with no Node.js code, since this library must be mounted inside a Node.js server
- Projects that do not use Node.js, because the package is for the Node.js ecosystem
How to get it
- 1
Install with a package manager
You'll need: Node.js
Install as a dev dependency
npm install --save-dev http-proxy-middleware - 2
Run it
- Install the package with npm.
- Create a server with Express or another supported server.
- Call createProxyMiddleware with a target URL.
- Mount the proxy on a path with app.use('/api', proxy) and start the server.
- 3
Get the most out of it
- Set changeOrigin to true when proxying to name-based virtual hosted sites, as the README recommends.
- Use pathFilter with glob patterns to limit which requests are proxied.
- Use pathRewrite to change paths before they reach the target.
- Use router to send different hosts or paths to different targets.
- Use the logger option and debugging section to troubleshoot requests.
Downloads
Strengths
- Works with several Node.js servers, including Express, Connect, Next.js, and Hono according to the README
- Configuration is done through a single createProxyMiddleware call with documented options
- Actively maintained with a README that documents options, WebSocket support, and examples
Trade-offs
- The README is truncated in this analysis, so some details of setup and advanced behavior could not be verified here
- Requires writing Node.js code; it is not a configurable tool out of the box
- Current docs cover v4.x only; older versions have separate documentation
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| http-proxy-middleware (this) | 11.1k | Library | intermediate | 5 days ago | Node.js developers running an Express, Connect, or Next.js dev server who need to forward /api requests to a backend |
| apollo-server | 14k | Library | intermediate | 5 days ago | Node.js developers who want to add a GraphQL API to an existing Express, Koa or Hapi app |
| echo | 32.8k | Library | intermediate | 7 days ago | Go developers building REST APIs or backend services |
| ws | 22.8k | Library | beginner | 5 days ago | Node.js developers who need a WebSocket server or a backend WebSocket client |
| mitmproxy | 46.6k | Dev tool | intermediate | 4 days ago | Developers debugging how an app talks to a backend API |
| hysteria | 22.8k | App | intermediate | 10 days ago | People on networks with heavy packet loss who want a faster proxy connection |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.