﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
459	HTTP 304 NOT MODIFIED should not set Content-Length	robin.smidsrod.no		"Using nginx from the stable Ubuntu PPA.

Had a long conversation with people on IRC and noticed that HTTP 304 NOT MODIFIED responses for static content has Content-Length set to the actual size of the content, and an empty body.

According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5 and http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 Content-Length (which is an entity header) should not even be returned in 304 responses.

I noticed this when I had a FastCGI backend server which sent 304 responses with non-zero Content-Length or with a HTTP body (both which seem wrong). This caused some kind of keep-alive error in Chrome 31 which caused corrupt content to be downloaded.

After I fixed that error in the backend FastCGI server I also noticed nginx does the same thing for static content. It sets Content-Length to the size of the file.

Setting Content-Length to 0 for 304 responses seem to solve all issues I've had with Chrome, but I'm not sure if that is actually the right solution. From my understanding of the RFCs it seems like Content-Length shouldn't be set at all.
"	defect	closed	minor		nginx-core	1.3.x	invalid		robin@…	Linux pf 2.6.32-54-server #116-Ubuntu SMP Tue Nov 12 19:37:57 UTC 2013 x86_64 GNU/Linux	"nginx version: nginx/1.4.1
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-http_gzip_static_module --with-http_ssl_module --with-ipv6 --without-http_browser_module --without-http_geo_module --without-http_limit_req_module --without-http_limit_zone_module --without-http_memcached_module --without-http_referer_module --without-http_scgi_module --without-http_split_clients_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_uwsgi_module --add-module=/build/buildd/nginx-1.4.1/debian/modules/nginx-echo
"
