删除nginx proxy_pass中的Content-Length标头

我使用nginx与代理path指令。
当请求被代理到的应用程序返回一个响应时,看起来nginx添加了一些包含Content-Length的头文件。 有可能删除这个额外的头?

UPDATE

我用more_headers模块重新安装了nginx,但是我仍然有相同的结果。 我的configuration是:

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; } } 

您需要安装ngx_headers_more模块,然后使用more_clear_headers:

http://wiki.nginx.org/NginxHttpHeadersMoreModule#more_clear_headers

 more_clear_headers syntax: more_clear_headers [-t <content-type list>]... [-s <status-code list>]... <new-header>... default: no context: http, server, location, location if phase: output filter 

在你的具体情况下,你可能想要添加:

 more_clear_headers 'Content-Length'; 

这是由于nginx在http 1.0中与后端对话所致,我需要在后端发送的响应中添加内容长度,以避免将编码设置为分块。