-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Labels
Description
Describe the bug
If I want to use ngx.fetch to forward request to some other server (aka proxy_pass) I'm copying r.headersIn and passing r.requestText as body. But this method fails.
I've found that I can fix bug by adding headers.delete('content-length');. This makes me think that in such config ngx.fetch passes two content-length headers to server and it fails to parse it.
https://github.com/nginx/njs/blob/master/nginx/ngx_js_fetch.c#L691
To reproduce
I've created gist with complete nginx.conf and js module:
https://gist.github.com/pyhedgehog/8f3bf0e8373aeb3f75c7b23347a1e578#file-showbug-md
Expected behavior
Possible solutions:
- Skip
content-lengthfrom input headers. - Skip generating
content-lengthif it already in headers (like withhas_host). - Document this behavior.