<p>hi all :-)<br /><br />i am trying to inject a content-length header into a response from an upstream&nbsp;because the upstream is not capable of sending a content-length since the size of the body is not known until the end is actually reached.<br /><br />my current config is:<br /><br />location / {<br />&nbsp;&nbsp;proxy_buffering on;<br />&nbsp;&nbsp;proxy_pass http://upstream;<br />&nbsp;&nbsp;chunked_transfer_encoding off;<br />&nbsp;&nbsp;add_header Content-Length $upstream_response_length;<br />}<br /><br />now when using&nbsp;upstream_response_length in the log_format i get a non-zero value but when used in add_header its zero.<br />i needed to turn off&nbsp;chunked_transfer_encoding because otherwise the client will choke.<br /><br />nginx gives the warn log:&nbsp;an upstream response is buffered to a temporary file /var/tmp/nginx/proxy/1/00/0000000001 while reading upstream, [...]&nbsp;so the response length should be known in this case.<br />but i guess the prob
 lem is since this is with headers the response would have to be split first which should then yield a (new) variable like upstream_body_size or similar.<br /><br />any help is highly appreciated.<br /><br />thanks in advance.<br /><br />greets,<br />elm0&nbsp;</p>