RE: [squid-users] Re: Caching downloaded files from dynamic pages

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Tue, 25 Sep 2007 22:54:02 +0200

On tis, 2007-09-25 at 21:34 +0300, Alexander K wrote:

> The last one is interesting; I can actually see the full uri, which is good.
>
> If I use the full uri:
> http://support.fujitsu-siemens.com/download/FileDownload/fileDownload.aspx?S
> oftwareGUID=1758541C-E30A-4126-B5E4-F9DBF9D9E8CC&FileFolder=Downloadfiles&Fi
> leTypeExtension=zip&FileNameClient=FSC_WN6301A_miniCard_WLAN_IEEE802_11_b_g_
> 7_1_0_70__1008383.zip&FileSize=436724&From=SWpoW1djPF9iW0plOGhlbWlbaB0m
>
> It gives me the download-dialog and I can successfully download the file.
>
> However, if I download the file, remove it and re-download, it ain't coming
> from cache.
> I am using the same uri both times, just copy-pasting the uri.
>
> Now I don't have idea why the item is not being cached / why does not Squid
> recognize it?

Because the server really do not want the file to be cached.

The headers says:

HTTP/1.1 200 OK
Date: Tue, 25 Sep 2007 19:10:49 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Content-Disposition: attachment; filename=FSC_WN6301A_miniCard_WLAN_IEEE802_11_b_g_7_1_0_70__1008383.zip
Content-Length: 436724
Set-Cookie: ASP.NET_SessionId=hcxqcyqdyh22nlur05xzr5j2; path=/
Cache-Control: private
Content-Type: application/octet-stream

The key thins here is
a) That it's a query URL, with what looks like unique parameters, so
each request will likely be different even if you convince Squid to
cache the result..

b) The server has expressed a quite strong opinion that the file must
not be cached in shared caches (Cache-Control: private).

c) There is no Expires/Last-Modified/max-age headers to base freshness
calculations on.

d) There is no ETag for conditional caching (where the content is
cached, but each query is first verified with the origin).

Note: Squid-3 has a refresh_pattern override for overriding overriding
Cache-Control: private.

So any solution for caching these objects is going to be quite custom
tailored for this site. There is no generic workaround to cache such
cache-unfriendly objects.

> Do I need to modify mime / file assocations somehow?

No. Not releveant to HTTP caching.

> Also, I think that to get this work, the string after "&From" should be
> static. That leads to another question: is there way to manipulate / replace
> part of uris using Squid?

Yes, by using an url rewriter. See url_rewriter_program.

Regards
Henrik

Received on Tue Sep 25 2007 - 14:54:07 MDT

This archive was generated by hypermail pre-2.1.9 : Mon Oct 01 2007 - 12:00:03 MDT