Value of "Expires" header differ for caching and content serving servers

i.s.ivanov2 nginx-forum at nginx.us
Wed Apr 6 14:47:10 MSD 2011


I have a following servers structure:
content.server contains an Apache instance, which processes one simple
PHP script. On the same node Nginx is set as a caching proxy to that
Apache.
caching.server contains Nginx with proxy_cache directive, with upstream
set to content.server

Php script generates an XML file, that has a lifetime of 30 minutes.
This is achieved by setting headers in PHP code: "Cache-Control:
max-age=1800", "Date: now()" and "Expires: now()+1800seconds".

content.server serves the cached file correctly:
>   Date	Wed, 06 Apr 2011 09:50:49 GMT
>   Cache-Control	public, must-revalidate, max-age=1800
>   Expires	Wed, 06 Apr 2011 10:14:25 GMT
>   Etag	26ee7051c360ee28d2a5697fb2b97a03

But approximately half of the time caching.server serves the content
where Date header is larger than Expires, and Expires is different from
the one on content.server:
>  Date	Wed, 06 Apr 2011 09:49:58 GMT
>  Cache-Control	public, must-revalidate, max-age=1800
>  Expires	Wed, 06 Apr 2011 09:44:23 GMT
>  Etag	26ee7051c360ee28d2a5697fb2b97a03


My questions is: what can cause such behaviour, when caching nginx sets
its own Expires header?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,188725,188725#msg-188725




More information about the nginx mailing list