Welcome! Log In Create A New Profile

Advanced

Re: Content-Length header missing after proxying

Maxim Dounin
August 24, 2011 02:16AM
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Content-Length header missing after proxying

James Fidell August 23, 2011 02:46PM

Re: Content-Length header missing after proxying

nexthop August 24, 2011 01:28AM

Re: Content-Length header missing after proxying

James Fidell August 24, 2011 03:48AM

Re: Content-Length header missing after proxying

Maxim Dounin August 24, 2011 02:16AM

Re: Content-Length header missing after proxying

James Fidell August 24, 2011 03:54AM

Re: Content-Length header missing after proxying

Igor Sysoev August 24, 2011 06:38AM

Re: Content-Length header missing after proxying

James Fidell August 24, 2011 07:22AM

Re: Content-Length header missing after proxying

Igor Sysoev August 24, 2011 08:22AM

Re: Content-Length header missing after proxying

Matthias R. W. September 06, 2011 10:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready