Content-Length header missing after proxying

James Fidell james at
Tue Aug 23 18:44:20 UTC 2011

I have nginx configured to proxy to an upstream using the following
in nginx.conf:

http {
     upstream app {
         server localhost:8080;

     server {
         listen       80;

         location / {
		proxy_pass http://app;
		# proxy_pass_header Content-Length;

The upstream returns some data with the HTTP Content-Length header
set.  Using wget to connect directly I see:

Connecting to localhost||:8080... connected.
HTTP request sent, awaiting response...
   HTTP/1.0 200 OK
   Content-Type: application/x-javascript
   Connection: keep-alive
   Content-Length: 44552
Length: 44552 (44K) [application/x-javascript]

When I make a request via nginx however, the Content-Length header is
no longer present (again using wget):

Connecting to localhost||:80... connected.
HTTP request sent, awaiting response...
   HTTP/1.1 200 OK
   Server: nginx/1.0.5
   Date: Tue, 23 Aug 2011 18:40:30 GMT
   Content-Type: application/x-javascript
   Connection: close
Length: unspecified [application/x-javascript]

Is there any obvious reason this should be happening, or something I'm
doing wrong?  The proxy_pass_header directive in the configuration file
seems to make no difference to the outcome when I uncomment it.


More information about the nginx mailing list