Open
Description
Problem
When option {parseReqBody: false}
is used, the original request content-length
header is lost when the request is forwarded to the target origin.
Analysis
It looks like the header is removed here:
express-http-proxy/lib/requestOptions.js
Lines 52 to 65 in b05cb04
But then is only recalculated when parseReqBody
is true
, here:
Potential solution
When {parseReqBody: false}
...
- If
bodyContent
is provided, thencontent-length
could be determined from the size ofbodyContent
- If
bodyContent
is not provided (i.e.proxyReq
is piped), then the originalcontent-length
header could be restored (if defined)
Supposing number item 1 is handled (content-length
determined from size of bodyContent
), then it may not be necessary to remove content-length
from the original request at all. It would be overwritten in sendProxyRequest
when appropriate and left alone otherwise.
Metadata
Metadata
Assignees
Labels
No labels