whatisgithub

What is http-proxy-middleware?

chimurai/http-proxy-middleware — explained in plain English

Analysis updated 2026-06-24

11,124TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A Node.js library that forwards HTTP requests from your server to another server, commonly used to bypass browser CORS restrictions when a frontend and backend run on separate addresses.

Mindmap

mindmap
  root((repo))
    What it does
      HTTP request forwarding
      CORS workaround
      Path rewriting
      WebSocket proxy
    Tech stack
      TypeScript
      Node.js
      Express
      httpxy
    Features
      Path filtering
      Request interception
      Plugin system
    Frameworks
      Express
      Next.js
      Connect
      Hono
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Route API calls from a React or Next.js frontend through a local proxy to avoid browser CORS errors during development.

USE CASE 2

Rewrite URL paths before forwarding, map /api/v1 on your server to a different path on the target service.

USE CASE 3

Forward WebSocket connections through the same proxy middleware alongside regular HTTP requests.

USE CASE 4

Bundle reusable proxy configuration as a named plugin to apply consistent routing across multiple server setups.

What is it built with?

TypeScriptNode.jsExpressNext.js

How does it compare?

chimurai/http-proxy-middlewareyishentu/claudiananomalyco/opentui
Stars11,12411,12911,099
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderatemoderate
Complexity2/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

http-proxy-middleware is a Node.js library that lets you forward incoming HTTP requests from your server to a different server. This is commonly needed when building web applications where the frontend and backend run on separate addresses, and you want the frontend to be able to make requests without hitting browser security restrictions that block cross-origin requests. The library is designed to work as middleware, meaning you plug it into an existing server framework rather than running it standalone. It works with popular Node.js server tools including Express, Connect, Next.js, and Hono, among others. Setting it up is typically a single function call where you specify the destination server address. Once configured, incoming requests that match a path you specify get forwarded to the target server. The library gives you options to filter which requests get proxied using path strings, wildcard patterns, or a custom function. You can also rewrite the URL path before forwarding, so for example a request coming in at /api/users could be sent to /v2/users on the target server. For more advanced use cases, the library allows you to intercept and modify both requests before they are forwarded and responses before they are returned to the original caller. It also supports WebSocket connections, not just regular HTTP. A plugin system lets you bundle reusable configuration as named plugins. The package is available on npm and the source code is written in TypeScript, so type definitions are included. It relies on an underlying proxy library called httpxy, which is a maintained fork of the older http-proxy package. The project has a test suite and documentation with working examples for common scenarios. It is released under the MIT License.

Copy-paste prompts

Prompt 1
I have an Express server and a separate API server on a different port. Show me how to configure http-proxy-middleware to forward /api requests to the API server and avoid CORS errors.
Prompt 2
I need to rewrite the URL path before proxying, requests at /api/users should be forwarded as /v2/users on the target. How do I configure pathRewrite for this?
Prompt 3
How do I intercept and modify the response body before it is returned to the client using http-proxy-middleware's response interceptor?
Prompt 4
Show me how to add http-proxy-middleware to a Next.js app so API requests from the browser are proxied to a separate backend service.

Frequently asked questions

What is http-proxy-middleware?

A Node.js library that forwards HTTP requests from your server to another server, commonly used to bypass browser CORS restrictions when a frontend and backend run on separate addresses.

What language is http-proxy-middleware written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, Express.

What license does http-proxy-middleware use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is http-proxy-middleware to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is http-proxy-middleware for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.