Re: [squid-users] load ad from cache

From: Chris Robertson <crobertson@dont-contact.us>
Date: Thu, 06 Dec 2007 14:42:48 -0900

Rishav Upadhaya wrote:
> Hi,
>
> Hi, we know that there are google adsense and many other advertising sites.
>
> If the url contains (ad|ads|pagead2|yieldmanager) I want those pages
> to load from the cache and always.
>

Oof. Good luck with that. Ad servers are very cache-unfriendly by
design (they want to be able to report how many page views, and by
who). They set cookies (which hinders caching), specify that the
content is private (and therefore not cacheable by Squid), use GET
queries (to determine what site the add is showing on), and specify
Pragma: no-cache and/or Cache-Control: no-cache among other tricks.

> so I tried something like this.
> refresh_pattern -i (ad|ads|pagead2|yieldmanager) 43200 90% 129600
> override-expire
>

For what it's worth, refresh pattern takes a regular expression as its
argument. (ad|ads|pagead2) is redundant, as "ad" will match "ads" and
"pagead2". It will also match "mad". It's a bit vague.

> but it didn't worked.
>
> Can you please correct me.
>

If you don't mind messing with a lot of the net, you can try...

refresh_pattern -i (ad|yieldmanager) 43200 90% 129600 override-expire
override-lastmod ignore-no-cache ignore-private

..but I would advise you fix that regex first. You'll also have to find
the line "acl QUERY urlpath_regex cgi-bin \?" and the following "cache
deny QUERY" and set up something that allows caching for advertisements
with query parameters.
> Regards,
> Rishav
>

Chris
Received on Thu Dec 06 2007 - 16:42:55 MST

This archive was generated by hypermail pre-2.1.9 : Tue Jan 01 2008 - 12:00:01 MST