﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
558	Conditional (If-None-Match) requests against cached content require Last-Modified header	Owen Garrett		"Summary - conditional requests using If-None-Match ""eTag"" don't match content that does not also have a Last-Modified header.


'''Expected behavior:'''
	Content cache stores content with etag.
	Requests with ‘if-none-match’ should honor that etag
'''Observed behaviour: '''
	Requests only honor that etag if the response /also/ contains a ‘last-modified’ header
 
Test case: Architecture: http proxy with cache -> fastcgi proxy -> php script
 

'''Test 1 – provide a last-modified header – works as expected:'''
 
<?php
header(""Cache-Control: max-age=600"" );
header(""ETag: foo"");
header(""Last-Modified: Sat, 02 Nov 2013 14:53:29 GMT"");
print time().""\n"";
?>

Prime the empty cache: 
# curl -D - http://localhost:8001/time.php
HTTP/1.1 200 OK
Server: nginx/1.5.12
Date: Sun, 04 May 2014 23:31:55 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.10-1ubuntu3.11
Cache-Control: max-age=600
ETag: foo
Last-Modified: Sat, 02 Nov 2013 14:53:29 GMT
X-Cache-Status: MISS
 
1399246315


Request the content with if-none-match - works as expected:

# curl -D - -H ""If-None-Match: foo"" http://localhost:8001/time.php
HTTP/1.1 304 Not Modified
Server: nginx/1.5.12
Date: Sun, 04 May 2014 23:32:09 GMT
Connection: keep-alive
X-Powered-By: PHP/5.3.10-1ubuntu3.11
Cache-Control: max-age=600
ETag: foo
Last-Modified: Sat, 02 Nov 2013 14:53:29 GMT
X-Cache-Status: HIT
 

 
'''Test 2 – omit last-modified – the if-none-match does not apply:
''' 
<?php
header( ""Cache-Control: max-age=600"" );
header(""ETag: foo"");
#header(""Last-Modified: Sat, 02 Nov 2013 14:53:29 GMT"");
print time().""\n"";
?>
 
Prime the empty cache:
# curl -D - http://localhost:8001/time.php
HTTP/1.1 200 OK
Server: nginx/1.5.12
Date: Sun, 04 May 2014 23:32:42 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.10-1ubuntu3.11
Cache-Control: max-age=600
ETag: foo
X-Cache-Status: MISS
 
1399246362

'''Request the content with if-none-match - we get a 200, not a 304:
'''
# curl -D - -H ""If-None-Match: foo"" http://localhost:8001/time.php
HTTP/1.1 200 OK
Server: nginx/1.5.12
Date: Sun, 04 May 2014 23:32:50 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.10-1ubuntu3.11
Cache-Control: max-age=600
ETag: foo
X-Cache-Status: HIT
 
1399246362
 "	enhancement	closed	minor		nginx-core	1.5.x	fixed	etag if-none-match		Linux dev 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.5.12
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_f4f_module --with-http_hls_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_session_log_module --with-syslog --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-ipv6 --with-http_perl_module --with-http_image_filter_module --with-http_geoip_module --with-http_xslt_module --add-module=debian/extra/ngx_devel_kit-0.2.19 --add-module=debian/extra/lua-nginx-module-0.9.4 --add-module=debian/extra/headers-more-nginx-module-0.25 --add-module=debian/extra/set-misc-nginx-module-0.24 --add-module=debian/extra/passenger-4.0.41/ext/nginx --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed'"
