next-http-proxy-middleware
next-http-proxy-middleware copied to clipboard
Additional headers doesn't write to request
I am experiencing problem that I am not able to add any custom headers. I have made a quick look on your code and I don't see any action with headers on proxy request ...
Hi @3nodecz, You can add custom headers through the http-proxy setting.
- ref: https://www.npmjs.com/package/http-proxy#options
Please refer to the source code below 😀
// Custom headers examples
export default (req: NextApiRequest, res: NextApiResponse) => (
isDevelopment
? httpProxyMiddleware(req, res, {
...
headers: {
HELLO: 'Hello :)', // <- You can add custom headers
},
})
: res.status(404).send(null)
);