Re: [squid-users] Need some help

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 3 Dec 2008 11:18:32 +1300 (NZDT)

> Hi
>
> I need some help in configuration or some snippet to help me in
> configuring squid to cache frequently downloaded non static file from
> my application. each file has a different ID. I am totally new to this
> squid configuration, any help provided is deeply appreciated.
>
> Also the url will be something like this which downloads the pdf file.
> The PDF documents I mentioned are big and they need to be retrieved
> everytime from database whenever user requests, and we have quite a
> volume of users and their requests for these documents hence we
> thought of caching these frequently requested/downloaded pdf documents
> and the less frequent ones are either flushed out of cache and the
> ones which are not requested should not be cached.
>
> I hope I made some sense. The following is the example URL.
>
> http://testg.org/intn4/download.action?fTId=159501
>
>
> 1) I need to configure this first on windows box.
> 2) what are all the commands I should be looking at to configure.

Ensure that you gave a recent Squid of at least Squid-2.6.
Here is an example config for website acceleration
http;//wiki.squid-cache.org/SquidFaq/ReverseProxy

For your particular URLs....

"cache deny QUERY" is a default in many squid releases which prevents
caching of anything with '?' in the URL.

You will need to either ...
  remove the QUERY ACL and related lines that use it completely. Replacing
with a "refresh_pattern -i (/cgi-bin/|\?) 0 0% 0" just above the '.'
pattern.

OR:
  create an ACL to match your files, either dstdomain on your domain to
cache all the domains files or
  acl ourPdfs url_regex -i "http://testg\.org/intn4/download\.action"
to catch just the download.action files.
Then "cache allow ourPdfs" before the QUERY denial.

Either way your download script will also need to set Cache-Controls: and
Expires: headers properly to allow caching of the files for some period
when you are sure they are valid.

If it can be upgraded to handle If-Modified-Since requests without heavy
DB access that would be an extra large boost to your sites performance.

If the download script cannot be fixed to provide correct Cache-Controls,
then a refresh_pattern to match just your files can be used to make your
squid expire the objects reasonably. But only proper Cache-Controls
enables other caches around the web to assist with the heavy lifting, DDoS
protection, and bandwidth reduction.

> 3) logging and also any permissions needed

Nothing. They will show up same as before but with TCP_HIT instead of
TCP_MISS in access.log.

Amos
Received on Tue Dec 02 2008 - 22:18:35 MST

This archive was generated by hypermail 2.2.0 : Wed Dec 03 2008 - 12:00:02 MST