Next.js HTTP Proxy Middleware
HTTP Proxy middleware available in API Middleware provided by Next.js.
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
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.
keyis a regular expression to match
url, and the matched url string is replaced with
Refer to the following for how to use Nextjs API Middleware