<div dir="ltr">
<p class="gmail-p1"><span class="gmail-s1">Thanks Amos! Learned a lot. I changed .conf file and it works as expected. </span></p><p class="gmail-p2"><span class="gmail-s2"></span></p></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 3:30 AM, Amos Jeffries <span dir="ltr"><<a href="mailto:squid3@treenet.co.nz" target="_blank">squid3@treenet.co.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 28/07/2016 1:33 p.m., John Pearson wrote:<br>
> Hi,<br>
><br>
> main problem: different squid configurations are not caching certain files.<br>
><br>
> These are my conf files `1_squid.conf` and `2_squid.conf` both can be found<br>
> here:<br>
><br>
> <a href="https://gist.github.com/ironpillow/e6b86354f4ac3941f74db86d893008f1" rel="noreferrer" target="_blank">https://gist.github.com/ironpillow/e6b86354f4ac3941f74db86d893008f1</a><br>
><br>
> I am using <a href="http://www.thinkbroadband.com/download/" rel="noreferrer" target="_blank">http://www.thinkbroadband.com/download/</a> to download the 5MB zip<br>
> file but it's always a tcp_miss UNLESS I uncomment (use) lines 57 and 58 in<br>
> 1_squid.conf. dmg files are being cached.<br>
><br>
> But when using 2_squid.conf, the above zip file is cached (tcp_hit) but dmg<br>
> files (<a href="https://support.apple.com/kb/dl1870?locale=en_US" rel="noreferrer" target="_blank">https://support.apple.com/kb/dl1870?locale=en_US</a>) are not being<br>
> cached.<br>
><br>
> Any advice?<br>
<br>
</span>Quite a lot.<br>
<br>
Firstly, the design of those two configs is quite different about what<br>
they do when caching. Some of the below details about #1 config should<br>
explain why #2 config does them differently, the rest of the changes<br>
apply to both configs.<br>
<br>
Specifics:<br>
<br>
1) there are no such things as "files" in HTTP. "file" is a disk storage<br>
concept. Network transfer protocols are about resources and where they<br>
are located (URL). Any relationship between URL and a filename is a<br>
coincidence of that domains designer having made it so, and certainly<br>
not reliable in the general case. That effects the (3) behaviour below.<br>
<br>
2) in HTTP the relationship between "site" and URL is tenuous at best.<br>
Just because one URL is displayed as being where to fetch an object does<br>
not mean thats where the object resides. Redirects can happen in between<br>
initial fetch, and your Store-ID helper will also be having effects on<br>
what URL the refresh_pattern see as representing the object.<br>
<br>
3) the regex patterns you have for URLs *ending* with specific 4-letter<br>
sequences between lines 54-70 are;<br>
a) specifically bound to individual domain names (thats good because of<br>
#1 above), and<br>
b) do not include the domains you mention having trouble with (which<br>
explains why they do not do what you expect to those domains).<br>
<br>
4) due to the way you have configured the "cache" directives. Only<br>
domain names listed in /etc/squid/updatesites.txt will ever be stored by<br>
Squid. This effects the behaviours created by (2) and (3) -<br>
refresh_pattern is only relevant for stored content.<br>
<br>
5) Squid *will not* store responses for intercepted traffic unless it<br>
can verify the server being contacted is actually the authoritative<br>
origin server for that URL domain.<br>
* The DNS servers behind "8.8.8.8" are expicitly configured to rotate<br>
teh IP addresses on every single lookup. Which makes it almost<br>
guaranteed that Squid and the client being intercepted will be seeing<br>
different sets of origin servers when they lookup the domain.<br>
<br>
6) configuring "dns_defnames" to pass *single label* domain names out to<br>
the global 8.8.8.8 service is plain wrong. Remove that line.<br>
<br>
7) "logformat squid" - do not redefine Squid's built-in log formats. It<br>
will *not* record the values you think it records.<br>
<br>
8) remove the comment from line 84 of 1_squid.conf. That line defines<br>
the proper way to deal with URLs when they have query strings.<br>
<br>
9) remove the "regex_pattern -i cgi-bin" lines at 86-87. Its an old and<br>
wrong config setting.<br>
<br>
10) you can remove the "always_direct allow all" it is about whether to<br>
use cache_peer's and is pointless in your configuration that doesn't use<br>
any peers.<br>
<br>
Amos<br>
<br>
_______________________________________________<br>
squid-users mailing list<br>
<a href="mailto:squid-users@lists.squid-cache.org">squid-users@lists.squid-cache.org</a><br>
<a href="http://lists.squid-cache.org/listinfo/squid-users" rel="noreferrer" target="_blank">http://lists.squid-cache.org/listinfo/squid-users</a><br>
</blockquote></div><br></div>