Content-length Missing when response proxy_pass a special backend

Maxim Dounin mdounin at
Sun Oct 9 20:55:25 UTC 2011


On Sun, Oct 09, 2011 at 10:26:37AM -0400, fzuslide wrote:


> Content-Type: application/octet-stream
> Transfer-Encoding: chunked


> Content-Type: image/jpeg
> Connection: keep-alive
> Content-Length: 1014


> I need the "Content-Length" for calculating the downloading process in
> client.
> But I really don't know with same config, why "Content-length" missing
> when a special response proxy_pass by nginx, and another is ok.
> Could anybody tell me why? Thanks a lot :)

nginx removes Content-Length header (and uses chunked if possible)
if resulting length after processing isn't known.  This happens
e.g. if you use gzip, ssi, sub or addition modules.

> My config:
> server {
>     listen;


> }

You have to provide full config (i.e. what's on http level?).  
Best guess without seeing your config is that you have ssi or 
something similar enabled for "application/octet-stream", but not 
for "image/jpeg".

Maxim Dounin

More information about the nginx mailing list