fre 2008-06-06 klockan 01:14 +0800 skrev howard chen: > E.g. > http://www.uwants.com/images/home/title_forum.jpg That server is broken and returns different ETags for the same object. I would guess it's a replicated Apache cluster where Apache hasn't been properly configured for such setups (the ETag generation needs to be configured to not include inode number in the ETag input, as it differs between replicated servers even if the object is the same...) GET /images/home/title_forum.jpg HTTP/1.0 If-Modified-Since: Sat, 10 Feb 2007 14:12:22 GMT If-None-Match: "b6872a-1580-dd65bd80" Host: www.uwants.com Accept: */* Via: 1.1 localhost:3128 (squid/2.HEAD-CVS) X-Forwarded-For: 127.0.0.1 Cache-Control: max-age=0 Connection: keep-alive HTTP/1.1 200 OK Date: Thu, 05 Jun 2008 20:06:56 GMT Server: Apache/2.0.55 (Unix) PHP/4.4.2 Last-Modified: Sat, 10 Feb 2007 14:12:22 GMT ETag: "bd5498-1580-dd65bd80" Accept-Ranges: bytes Content-Length: 5504 Keep-Alive: timeout=5, max=1000 Connection: Keep-Alive Content-Type: image/jpeg > > Which only contains LM, ETAG but not Expire (I think it is Apache default setup) > > I use FF 2.0 and LiveHTTP header to view the req/response, and after I > got the file for the first time, my FF will not issue the second time, > even if I close my browser. > > If I press F5, then 200 is received. > > > >> 2. Squid will not cache for a file if expire has not been set, is it true? > > > > False. If there is no freshness assigned to the object Squid uses > > refresh_pattern to calculate one basedon Last-Modified. > > > > Since the default Squid conf do not have refresh_pattern being set, so > squid will NOT > cache file if only contains LM but missing Expire or Max-Age? > > > >> 3. The prioiry of client sending cache-control, max-age=0 is higher > >> than IMS and must force contacting the backend to refresh (i.e. not > >> 304 but 200). > > > > max-age=0 instructs caches to query the next hop to verify freshness > > using a conditional query (i.e. If-Modified-Since). Which means thata > > GET with max-age=0 will be transformed into an If-Modified-Since query > > by Squid if the object is cached. > > > > So far, my main problem, my squid never use IMS to call my apache, if > I request a file with max-age=0, the squid will always get from my > apache, which in turn my apache return 200 to squid [not 304], and > squid also return 200 to my client. > > I am not sure if squid provided IMS, but my client do send IMS to squid. > > (I don't have settings such as refresh_all_ims or reload_into_ims or > refresh_platten ) > > > Thank very much for your help. > > > Howard