[ERROR] - JSON POST BODY
See original GitHub issueIs this a question?
When using it with express server and trying to post json body, it seems like anything above 1KB since request fails. I tried using express.json() middle also body parser but it does not seem to go along smoothly with the proxy middleware. Any help regarding this issue would be helpful. Thanks in advance for the time.
this.app .use(this.parseRequestBody.bind(this)) .use(‘*’, apiProxy) .use(express.json()) .listen(proxyPort);
Is this a bug report?
Yes
Is this a feature request?
No
- http-proxy-middleware: 1.0.4
- http-proxy-middleware configuration { // This value is not used but this is mandatory. target: proxyPort.toString(), changeOrigin: true, followRedirects: true, preserveHeaderKeyCase: true, pathRewrite: this.rewritePath.bind(this), router: this.rewriteHost.bind(this), onError: function onError(err, _req, _res) { // TODO: In future expose it as a callback. }, onProxyReq: this.onProxyReq.bind(this) }
- server: express
- other relevant modules
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Getting error while POST request with JSON - Stack Overflow
When i am firing POST request i am expecting it to push the JSON content into the users object but instead of it...
Read more >Error creating JSON data source with "POST Body" parameters
When creating a JSON data source using HTTP Client as Data Route and POST as HTTP Method, there are two ways of adding...
Read more >HTTP status and error codes for JSON | Cloud Storage
HTTP status and error codes for JSON · 302—Found · 303—See Other · 304—Not Modified · 307—Temporary Redirect · 308—Resume Incomplete · 400—Bad...
Read more >Error while parsing JSON Response in REST API Post call
I am using Outsystems 10 and trying to consume a REST API (single method). I have copied and pasted the REST Request and...
Read more >Response codes - The REST API basics - Akeneo API
As JSON format is expected in all POST and PATCH requests, you will get this error response when your JSON body is malformed....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
I tried this from https://github.com/chimurai/http-proxy-middleware/issues/320#issuecomment-600470764 and it worked for me.
@chimurai @geoangelotti Sorry for the delay in responding. Back i already had in that order even after that it was causing me issues, for me it was a specific issue of post body being greater than 1KB. For some reason something was adding a header i had to delete below headers before passing the request object to the proxy middleware and everything worked fine after that. delete req.headers[‘expect’] delete req.rawHeaders[‘expect’]