2013-11-20 36 views
1


我有一個問題,在代理傳遞後,nginx刪除內容長度頭。應用程序後端發送gzip流,但指定了內容長度。
NGINX將類型內容類型更改爲分塊並刪除內容長度標題。
這不適用於應用程序,因爲它不是由瀏覽器讀取的,而是由專用應用程序讀取的,該應用程序需要指定content-legth。
指定chunked_transfer_encoding off;後,它會停止添加內容類型標題,但仍會刪除內容長度。如何禁用nginx中的任何標題修改?
的confing:nginx在proxy_pass後刪除內容長度http頭

upstream backend { 
     server 127.0.0.1:9090; 
} 


server { 
root /usr/share/nginx/www; 
index index.html index.htm; 

chunked_transfer_encoding  off; 

     location/{ 
      proxy_pass http://backend; 
      proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 
      proxy_redirect off; 
      proxy_buffering off; 
      proxy_set_header  Host   $host; 
      proxy_set_header  X-Real-IP  $remote_addr; 
      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for; 
     } 
} 

回答