POST request body is not proxied to the servers
See original GitHub issueI have in my backend defined:
var proxy = proxyMiddleware('/api', {
target: 'http://somehost.zero',
proxyTable: {
'/api/one': 'http://somehost.one',
'/api/two': 'http://somehost.two',
}
});
app.use(proxy);
and when I’m proxing POST request (lets say to the ‘/api/one’: ‘http://somehost.one’ ) I don’t know why but server http://somehost.one get request without body.
Did you had similar problem?
Issue Analytics
- State:
- Created 8 years ago
- Comments:27 (4 by maintainers)
Top Results From Across the Web
NginX fails to pass of POST request body when proxying ...
The request is routed to the live API correctly, but the data is empty! The NginX proxy does not pass along the request...
Read more >Set up Lambda proxy integrations in API Gateway
Learn how to configure a Lambda proxy integration request and integration response in API Gateway.
Read more >GitHub reverse proxy fails to pass POST request properly
A reverse proxy is typically used in situations where you need to send a request to another server in your control. Github probably...
Read more >Detect HTTPS Post Request Body (and JSON-Body)
Not enough details about your client, so it is hard to answer the question is it possible to see request before encryption at...
Read more >Configuration of limitations on POST requests - IBM
Although the request-body-max-read stanza entry limits the amount of POST content read and processed by Reverse Proxy, it does not prevent the request,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did a little test and I am able to receive POST data at the
target
server.I noticed you are using the
body-parser
middleware: https://github.com/dejewi/proxy-bug/blob/master/app.js#L16You might want to change to order of the middlwares you are using. Try moving the
http-proxy-middleware
above thebody-parser
Hope this solves the issue.
If you can’t change the order of the middleware; You can restream the parsed body before proxying the request. This should fix the POST request:
source: node-http-proxy/examples/middleware/bodyDecoder-middleware.js. (https://github.com/nodejitsu/node-http-proxy/pull/1027)