Search squid archive

Re: Caching problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 15, 2007 at 09:46:35AM +0200, Michael Jurisch wrote:
>> refresh_pattern only works when Expires: or Cache-Control:
>> headers are MISSING.
> 
> Well, I have just a simple test html file, which looks like this:
> <html>
> <head></head>
> <body>
> Test<br />
> <img src="test.jpg" />
> </body>
> </html>
> 
> So there are no Expires: or Cache-Control: headers in it,

The headers referred to above aren't part of the HTML, they're HTTP
headers as returned by your web server.

Try doing: telnet webserver 80

Then enter in:

GET / HTTP/1.0

followed by a blank line (i.e. hit enter twice after typing/pasting
the line above), and you'll see the response. The bit before the
content is the HTTP headers.

You can also ask for just the headers, with a HEAD request instead
of a GET request:

HEAD / HTTP/1.0

You can in fact put some "HTTP headers" into the HTML using a
special syntax.

<META HTTP-EQUIV="headername" CONTENT="header-value">

is equivalent to

headername: header-value

but not everything will parse these as if they were actual HTTP
headers.

> but it still seems not to work!? And related to that: in order to
> cache not html files (e.g. jpg and so on), this is only possible
> through the refresh_pattern rules, isn't it? Cos these files don't
> have these headers.

Again, it's up to the web server to send the headers before the
content itself.

In the absence of explit cache-control headers, squid (and other
programs) try to guess. Typically this is done by using the
Last-Modified date sent by the server as a guide: files modified
recently are cached for less time than files that haven't been
modified in months or years.

The refresh_pattern lines adjust squid's settings when dealing with
objects which it doesn't really know how long to cache. I didn't see
the start of this thread and I'm too lazy to check the archives to
see what you're trying to do, but maybe the above clarification will
help you achieve it.

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux