[squid-users] Re: Non-static content not being cached

From: GarethC <gareth_at_garethcoffey.com>
Date: Tue, 20 Mar 2012 08:42:20 -0700 (PDT)

Hi Michael,

I have found in the past that PHP files don't always get cached, you can
explicitly tell Squid to cache files with a particular file extension (e.g.
.php).

Here is a rule that I use...

refresh_pattern \.php 60 20% 30 ignore-reload override-expire
override-lastmod

This will force Squid to cache any PHP file (on any domain / sub-domain) for
60 seconds, it will ignore 'Pragma' headers which are sent when a user tries
to force a page refresh (i.e. CTRL + F5), and it will also override the last
modified date as specified by the web server.

If you needed to cache a PHP page that may have a query string tagged on the
end you can use the following...

refresh_pattern -i www\.mydomain\.co\.uk/scripts/myscript\.php(\?) 300 20%
30 override-expire override-lastmod ignore-reload

Almost the same as before, the '-i' option tells Squid that the pattern to
match is case insensitive (so the url can be in upper or lower case). I
enter the URL I want to match and then place the question mark at the end in
braces and escaped. Squid should now cache your script with a query string.

Hope that helps you out.

--
View this message in context: http://squid-web-proxy-cache.1019090.n4.nabble.com/Non-static-content-not-being-cached-tp4488287p4489257.html
Sent from the Squid - Users mailing list archive at Nabble.com.
Received on Tue Mar 20 2012 - 15:42:22 MDT

This archive was generated by hypermail 2.2.0 : Tue Mar 20 2012 - 12:00:04 MDT