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

Add important note about 'body-parser' #439

Merged
merged 1 commit into from
Jul 20, 2020

Conversation

sebastienroul
Copy link
Contributor

I spent 2 days to find my issue. It was very hard to find the problem, but in some case, the body-parser change the body POST, and thn this body post is not sent to the target correctly. Hope it helps

I spent 2 days to find my issue. It was very hard to find the problem, but in some case, the body-parser change the body POST, and thn this body post is not sent to the target correctly. Hope it helps
@ShragaUser
Copy link

@sebastienroul hey! just to clarify - what exactly was the issue with the post body?

@sebastienroul
Copy link
Contributor Author

@ShragaUser The post body was a form-urlencoded from a basic html form. The think I notice was when we had, in the html form the same input present 2 times then the body was {foo: ['X', 'X']} after the body parser.
With the body-parser before, the proxy request was not recognizided by the proxied server, and when we put it after, the request was accepted.
At the begining we spend lot of time to search pb in the http-proxy, but in fact it was somewhere else ;)

Take a look at chimurai/http-proxy-middleware#299 it's this one who put me on the track !
So, just an info in the doc would save time :o)

Bye

@aztack
Copy link

aztack commented Jun 16, 2020

Same here! the proxy MUST be put before app.use(bodyParser.json()) otherwise, POST requests are forwarded without the body. But you can not find out in the Chrome network panel. Chrome shows that everything is correct. After sniffing the requests with Wireshark, I found that the POST request body is not even there.

Copy link
Collaborator

@monkpow monkpow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@monkpow monkpow merged commit 1983acc into villadora:master Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants