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
proxyReq event fails when behind a corporate proxy #1287
Comments
Hello.
|
@amircodota , I also faced same issue with same headers related error when dealing with a react app passing these values via package.json. Just to check i directly modified the http-proxy-middleware under node_modules folder to use As of now I don't have a way to pass agent via package.json, see this question on stackoverflow, but these are the observations i came across. |
@sandeepkumar03 I'm not sure I completely understand your use case, but I think you are using webpack, and the webpack-dev-server to run your react app in development. |
have nobody fixed this |
We have been using http-proxy for a long time without a problem. (Congrats on that, BTW :-) )
Lately we have been working with a big enterprise customer, were our server runs behind a corporate proxy.
We used the corporate proxy recipe, but we ran into an issue where calling setHeader fails inside a proxyReq event, saying that
Can't set headers after they are sent.
.Note that this works fine in default circumstances, and only happens when using the HttpsProxyAgent as recommended in the recipe.
I was able to create a simple repro -
And then
Commenting out the
agent
option will make the curl request work.We thought of a workaround where we modify the original request object in a preceding middleware before the proxy middleware. This seems to work, but obviously is not the intended way of using it.
Anybody has other suggestions as to how to workaround/fix this issue?
Thanks
Amir
The text was updated successfully, but these errors were encountered: