-
Notifications
You must be signed in to change notification settings - Fork 2k
ECONNRESET when POSTing to a proxy through connect server #496
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
Comments
The |
This is being caused by https://github.com/senchalabs/connect/blob/master/lib/middleware/session.js#L306 Any ideas why this might be messing up the response when handled by the proxy? |
I think I've got to the bottom of this. I was buffering the request object further up the middleware chain than the connect session. The session calls By re-ordering my middleware, buffering after the session everything seems to work OK. Does anyone have any advice on this solution? thanks |
FWIW, I'm having the same symptom (POSTs fail when proxied, everything else works fine), but I'm not buffering. |
I'm also having this issue. |
@djmccormick I will be closing this as it is an old issue but the answer has to do with having any middleware that buffers the request data when attempting to proxy. The solution is to create a separate a proxy middleware to handle the intended routes before hitting that middlware OR create a separate router altogether that has its own middleware chain that does not parse the request. Hope this helps. If you cannot figure it out, open a new issue with a complete reproducible code sample |
We have written a proxy to authenticate http requests to several servers, following the recommended design pattern:
https://github.com/nodejitsu/node-http-proxy#proxy-requests-within-another-http-server
We are using
connect middleware
within this proxy to process cookie authentication and relay this internally to the servers via queryString parameters. The middleware in use is:Everything works ok for GET requests.
I'm having trouble with POST requests. Originally the requests were just hanging but I was able to resolve that using the
httpProxy.buffer(req)
.During a POST response the request is forwarded to the backend, the backend responds and then the proxy throws
{ [Error: socket hang up] code: 'ECONNRESET' }
.I've done some digging around.
Can anyone offer any advice?
connect : ~2.9.0
http-proxy : ~0.8.7
node : 0.8.24
Many thanks
The text was updated successfully, but these errors were encountered: