next-http-proxy-middleware

HTTP Proxy middleware available in API Middleware provided by Next.js.

Downloads
191.9K
Stars
231
Committers
10

Bot releases are hidden (Show)

next-http-proxy-middleware - v1.2.4 Latest Release

Published by stegano over 2 years ago

Fixes

  • fix: create proxy instance for each request(fix memory leaks) (#65)
next-http-proxy-middleware - v1.2.1

Published by stegano over 2 years ago

Features

  • feat: add onProxyInit option (#50)
next-http-proxy-middleware - v1.1.2

Published by stegano almost 3 years ago

Docs

  • docs(README.md): fix middleware path in README example (#47)
next-http-proxy-middleware - v1.1.0

Published by stegano about 3 years ago

Fixes

  • fix(rewritePath): change 'rewritePath' type for apply pattern priority (#39)

Docs

  • docs(README.md): add Using multipart/form-data section (#33)
next-http-proxy-middleware - v1.0.10

Published by stegano over 3 years ago

Fixes

  • fix: add methods that can include the request body(#22, #24)
next-http-proxy-middleware - v1.0.9

Published by stegano over 3 years ago

Fixes

  • fix: change http-proxy & types into dependencies (#17)
next-http-proxy-middleware - v1.0.8-hotfix.1

Published by stegano over 3 years ago

Fixes

  • fix: change http-proxy & types into dependencies (#17)
next-http-proxy-middleware - v1.0.8

Published by stegano over 3 years ago

  • fix: update all dependencies (#8, #9, #10, #11)
    • Security vulnerable dependencies and incorrect dependencies updated
next-http-proxy-middleware - v1.0.6

Published by stegano almost 4 years ago

Chores

  • chore(package.json): remove @types/next in dependencies (#8)
next-http-proxy-middleware - v1.0.5

Published by stegano almost 4 years ago

Fixes

  • fix: type error: this expression is not callable. (#7)
next-http-proxy-middleware - v1.0.4

Published by stegano over 4 years ago

v1.0.4

Fixes

  • Resolves an issue with no response from the target server when a put or post method is requested (#3)
next-http-proxy-middleware - v1.0.0

Published by stegano over 4 years ago

Next.js HTTP Proxy Middleware

HTTP Proxy middleware available in API Middleware provided by Next.js.

Installation

The easiest way to install next-http-proxy-middleware is with npm.


npm install next-http-proxy-middleware

Alternately, download the source.


git clone https://github.com/stegano/next-http-proxy-middleware.git

Features

This middleware is implemented using the http-proxy library. You can use the existing options provided by http-proxy. And you can rewrite the api path using pathRewrite, an additional option provided by this middleware.

Example

// pages/[...all].ts
...

export default (req: NextApiRequest, res: NextApiResponse) => (
  isDevelopment
    ? httpProxyMiddleware(req, res, {
      target: 'https://www.example.com',
      pathRewrite: {
        '^/api/new': '/v2', // `/api/new/test` -> `/v2/test`
        '^/api': '', // `/api/test` -> `/test`
      },
    })
    : res.status(404).send(null)
);

Package Rankings
Top 2.41% on Npmjs.org
Badges
Extracted from project README
All Contributors
Related Projects