-
Notifications
You must be signed in to change notification settings - Fork 2k
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
POST proxying with bodyParser middleware #955
Comments
I manage to work around the issue. But now I am facing an unique issue. The content seems to be truncated when the request is proxied to the server. I tried setting content-length to the body length and it does not work. Any suggestions ? |
It maybe be how you are measuring the length. That is the encoding may throw that off. I don’t think you need have a content-length specified. If not, just take the header out altogether. Also, make sure it is actually getting set. Validate that the destination server actually gets the header with the length you set. What I think is happening for you in the bodyParser middleware is mutating the content, and thus the length, before it goes to the destination server. |
@karthikus How did you work around the issue? |
Support for bodyparser.json and bodyparser.urlencoded. Fixes http-party#955 http-party#843 http-party#791
The following is my code.
route.js
app.js
But still the POST request hangs and ultimately fails.
I also use bodyparser middleware and it has a known issue as mentioned in Github issue. So I tried adding this line as the last line in app.js
I also tried restreamer code but I get the following error if I use the restreamer
error: uncaughtException: Can't set headers after they are sent.
I get this error because I emit end in the restreamer and then try to set the headers in proxy.on function. Any suggestions appreciated.
The text was updated successfully, but these errors were encountered: