On 18/02/2012 12:26 a.m., parashuram wrote:
Hi all,
I am using squid to cache dynamic responses from my particular server
everything working fine,
When I make first request access.log has
1329473470.110 0 192.168.0.40 TCP_MISS/200 856 GET
http://[ipv6address]:8080/.well-known/core - DIRECT/::1 text/html
Next request it logs following
1329473479.050 0 192.168.0.40 TCP_REFRESH_MODIFIED/200 856 GET
http://[ipv6address]:8080/.well-known/core - DIRECT/::1 text/html
request is in cache but due to resources being changed response is
from origin server( I've ignored must revalidated in refresh pattern).
I wanted request should be served from cache even if its modified and
log TCP_HIT or TCP_MEM_HIT in access.log.
any idea what might be going wrong??? suggestion how to tell squid not
send revalidiate signal to origin server to cross check for resource
modification???
server header response is as follows
(Status-Line) HTTP/1.0 200 OK
Date Fri, 17 Feb 2012 10:11:19 GMT
Content-Type text/html
Last-Modified Wed, 15 Feb 2012 07:48:34 GMT
Accept-Ranges bytes
Content-Lenght 8334
Cache-Control max-age=86400,public
Notice how "must-revalidate" is not present. Your override turing it off
does nothing.
What is happening here is that max-age is specifying that the object is
stale when older than 1 day, and needs revalidatating. (Date minus
Last-Modified) is stating that it is currently 2 days old.
Squid is only performing a REFRESH (if-modified-since) check, this is
very efficient if the server supports them. Your service should be
checking the last-modified and returning 304 status response if it is
older. It can in that response update the max-age and Expires values to
push the expiry time forward if it wants to.
Amos