express-http-proxy
express-http-proxy copied to clipboard
Only set content-length when request is not a GET request
Hi,
An app I'm trying to interact with is throwing a 400 error as this library will stringify an empty body ({}) resulting in a content length of 2, even though the content length of the GET request is 0.
I've submitted a PR that only sets the content-length header if the request is not a GET, I'm open to suggestions for other approaches though.
AWS CloudFront doesn't like GET requests with a body.
This fixed it for us:
proxyReqBodyDecorator: (bodyContent, srcReq) => {
if (srcReq.method === 'GET') return "";
return bodyContent;
},
Related: #475