Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional headers doesn't write to request #19

Open
3nodecz opened this issue Feb 20, 2021 · 1 comment
Open

Additional headers doesn't write to request #19

3nodecz opened this issue Feb 20, 2021 · 1 comment
Labels
good first issue Good for newcomers question Further information is requested

Comments

@3nodecz
Copy link

3nodecz commented Feb 20, 2021

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 ...

@stegano
Copy link
Owner

stegano commented Feb 26, 2021

Hi @3nodecz,
You can add custom headers through the http-proxy setting.

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)
);

@stegano stegano added good first issue Good for newcomers question Further information is requested labels Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants