﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
273	proxy_cache not work for 204 responses	Cícero Verneck Corrêa		"Nginx configuration for the application:
{{{
location / {
	uwsgi_pass		unix:/var/tmp/x.sock;
	uwsgi_cache		palco_cache;
	uwsgi_cache_valid	404 1m;
	uwsgi_cache_valid	302 8h;
	uwsgi_cache_valid	200 204 7d;
	uwsgi_cache_key		$uri$is_args$args;
	uwsgi_cache_lock	on;
	uwsgi_cache_use_stale	error updating timeout invalid_header http_500;
	uwsgi_cache_purge	PURGE from all;
	include			uwsgi_params;
	add_header		X-Cache $upstream_cache_status;
	uwsgi_ignore_headers	""Expires"" ""Cache-Control"";
}
}}}
The test application has a page that returns 200 and a content whatsoever, and another that returns 204 with the contents empty.

Below lay the answer to both.

204 HEADER:
{{{
HTTP/1.1 204 NO CONTENT
Connection: keep-alive
Content-Length: 0
Content-Type: text/html; charset=utf-8
Date: Fri, 04 Jan 2013 21:19:51 GMT
Server: nginx
X-Cache: MISS
}}}
200 HEADER:
{{{
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Fri, 04 Jan 2013 21:37:00 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Cache: HIT
}}}

No matter the number of requests, a request that returns 204 is never cached.
"	defect	closed	major		nginx-core	1.3.x	worksforme	cache, 204		Linux 10x 2.6.38-16-server #67-Ubuntu SMP Thu Sep 6 18:15:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.2.6
built by gcc 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
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 --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/home/studiosol/nginx_src/ngx_cache_purge"
