Re: [squid-users] Caching problem

From: Michael Jurisch <archer@dont-contact.us>
Date: Mon, 22 Oct 2007 16:04:29 +0200

Hi,

> > Now, if I hit "F5" in Browser (with and without deleting the
> > _browser_ cache) the access log shows this:
> >
> > "GET /pharma.html HTTP/1.0" 304 -
> > "GET /bild.jpg HTTP/1.0" 304 -
> >
> > I get the 304 code (which is correct), but I don't want to have
> > this control request. E.g. I want to say that squid "isn't
> > allowed" to look at origin server for 30 min. Squid should
> > consider the file(s) as fresh for 30 min and _after_ this period
> > it should look after the file on origin server.
>
> This is probably because you're telling Firefox to refresh the page,
> which causes it to set an HTTP header that tells the proxy you want
> it to check for updated content. (Pragma: no-cache or something
> similar?)
>
> See what happens if you load the site normally, then open something
> else in your browser, clear its disc and memory caches, and then
> open the site normally again. This will cause it to make a regular
> request, which squid should serve directly from cache if it
> considers its cached object to still be valid.

Well, if I do that exactly the same happens in the access log of the original webserver when I hit F5: it shows me that Squid looks at the webserver and sees, that the file was not modified (304). I have the mod_expires in Apache enabled and configured, so the content should be considered fresh for 5 mins. This, I thought, means also, that the request on origin webserver should not happen for 5 minutes -->
 
> Depending on your needs, you might want to look into the
> refresh_pattern options reload-into-ims and ignore-no-cache.

--> I tested both and also ignore-reload but I had no effect to my problem. I also tested this:
cache_peer www.myoriginalwebserver.de parent 80 0 no-query no-digest no-netdb-exchange originserver

But this had also no effect.

Well, I considered sth strange a few minutes ago. In my access.log of Squid I see this entry:
1193065658.351 136 www.myoriginalwebserver.de TCP_REFRESH_HIT/304 357 GET http://www.myoriginalwebserver.de/pharma.html - DIRECT/84.179.206.122 - [Host: www.myoriginalwebserver.de\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8\r\nAccept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nKeep-Alive: 300\r\nConnection: keep-alive\r\nIf-Modified-Since: Thu, 18 Oct 2007 11:20:04 GMT\r\nIf-None-Match: "4001f-d0-99882100"\r\nCache-Control: max-age=0\r\n] [HTTP/1.1 304 Not Modified\r\nDate: Mon, 22 Oct 2007 14:47:46 GMT\r\nServer: Apache/2.2.4 (Linux/SUSE)\r\nConnection: Keep-Alive\r\nKeep-Alive: timeout=15, max=100\r\nETag: "4001f-d0-99882100"\r\nExpires: Mon, 22 Oct 2007 14:52:46 GMT\r\nCache-Control: max-age=300\r\n\r]

The strange thing (at least to me) is that "Cache-Control: max-age=" appears _2_ time: once with "Cache-Control: max-age=0" and then with "Cache-Control: max-age=300". Is that ok? Or does this first max-age "disable" the second one with 300 seconds and that's why I always get these requests to the webserver? If yes, what should I do to get rid of on of the max-age-entries?

Thanks
Micha
Received on Mon Oct 22 2007 - 08:04:39 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Nov 01 2007 - 13:00:01 MDT