Remove Content-Length header in nginx proxy_pass

Posted by Luc on Server Fault See other posts from Server Fault or by Luc
Published on 2011-09-04T12:36:24Z Indexed on 2012/09/30 21:40 UTC
Read the original article Hit count: 212

Filed under:

I use nginx with proxy path directive.
When the application to which the request is proxied return a response, it seems nginx add some header containing the Content-Length. Is that possible to remove this additional header ?

UPDATE

I have re-installed nginx with the more_headers module but I still have the same result. My config is:

upstream my_sock {
   server unix:/tmp/test.sock
   fail_timeout=0;
}

server {
   listen 11111;
   client_max_body_size 4G;
   server_name localhost;

   keepalive_timeout 5;

   location / {
      more_clear_headers 'Content-Length';
      proxy_pass http://my_sock;
      proxy_redirect off;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
    }
}

© Server Fault or respective owner

Related posts about nginx