Missing Content-Length header when using Nginx + Gzip + Unicorn

I don't know why http response is missed "Content-Length header" when I use gzip in nginx, i'm really getting stuck,please somebody help me, thank you so much! this is my config file,


user nobody nobody ; worker_processes 8;

events { worker_connections 1024; accept_mutex on; # "on" if nginx worker_processes > 1 use epoll; # enable for Linux 2.6+ } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; upstream backend-unicorn { server unix:/tmp/unicorn_app.sock fail_timeout=0; #server localhost:5000; } #access_log logs/access.log main; sendfile on; keepalive_timeout 100; gzip on; gzip_static on; gzip_proxied any; gzip_http_version 1.1; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; gzip_types text/plain application/zip text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image$ server { listen 8080; server_name misago; access_log /var/log/nginx/unicorn.access.log main; client_max_body_size 64M; location /uploads/ { root /usr/local/rails_apps/me_management_tool/current/public/uploads; break; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }


I don't know why http response is missed "Content-Length header" when I use gzip in nginx

Because in this case the length of content is unknown at the moment of sending headers. Nginx cannot know how well the content will be compressed.


  • My node.js app is getting an Unhandled 'error' event randomly on writing requests after I
  • How to set vars into ansible inventory?
  • Optionally pass REMOTE_USER to application
  • Force download after ajax call
  • Force user to download file in PHP [duplicate]
  • How to download file from database/folder using php
  • How do I force the browser download all file types in a directory using .htaccess?
  • Downloaded file is damaged in django
  • ngix and php5-fpm blank page
  • Convert HTML table to Excel file in pure JavaScript using sheets.js plugin [duplicate]
  • SOAP response MTOM attachment can't be decrypted (AES algorithm)
  • PHP downloading excel file becomes corrupt
  • how can I get the file version on the Internet but not download it?
  • response.setContentType(“APPLICATION/OCTET-STREAM”)
  • First line of an auto genrated file is blank
  • Maintaining custom file extension in Internet Explorer when using PHP to send file?
  • Can any HTTP headers force iOS to download video (rather than streaming it) [closed]
  • Jersey - JAX/RS - how to handle different content-type using different handlers
  • Indexing documents using Solr results in Expected mime type application/octet-stream but got text/ht
  • PHP code to determine if a user was 301 redirected to my site
  • Missing Content-Length header when using Nginx + Gzip + Unicorn
  • search text only using Java
  • Youtube v3 api 401 Unauthorized
  • How to send a file AND other POST data with Synapse
  • Django login form in bootstrap popup
  • Instanciate service on startup in Angular2
  • Obtain actual browser URL in PHP
  • Streaming screenshots over WebRTC as a video stream from iOS
  • Configure nginx to return different files to different authenticated users with the same URI
  • How to use JavaScript to determine whether a file exists in a directory?
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Play WS (2.2.1): post/put large request
  • Bad request using file_get_contents for PUT request in PHP
  • How would I use PHP exceptions to define a redirect?
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Symfony2: How to get request parameter
  • log4net write single file for each call to log.info
  • Getting error when using KSoap library to consume .NET web services