Content-Length header missing after proxying
Maxim Dounin
mdounin at mdounin.ru
Wed Aug 24 06:14:00 UTC 2011
Hello!
On Tue, Aug 23, 2011 at 07:44:20PM +0100, James Fidell wrote:
> 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|127.0.0.1|: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|127.0.0.1|: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.
I suspect that you aren't using the config you provided above, but
instead additionally have something like ssi enabled, i.e.
something like
ssi on;
ssi_types application/x-javascript;
also present in your config.
Maxim Dounin
More information about the nginx
mailing list