[squid-users] caching js/css references with parameters, possible squid bug
Waitman Gobble
waitman at waitman.net
Sat Mar 19 11:50:11 UTC 2016
On 2016-03-18 01:00, Amos Jeffries wrote:
> On 18/03/2016 3:46 a.m., Waitman Gobble wrote:
>
>> When a script reference on an HTML page includes a parameter, the
>> script
>> does not appear to be cached when using squid in accel mode (https).
>>
>> For example,
>> <script type='text/javascript'
>> src='/wp-includes/js/jquery/jquery.js?ver=1.1.13'></script>
>>
>> jquery.js does not appear to be cached in that case, each page request
>> hits the originserver with a request for jquery.js. (also seems
>> browser
>> does not cache, either).
>
> How are you determining that?
>
> Dynamic content (as signalled by the '?query-string') is expected to
> revalidate on each use unless that origin has sent explicit
> cacheability
> headers. In HTTP/1.1 contact with the origin server is not always a
> full
> fetch.
I was watching HTTP logs on origin server, every page request was also
creating request for css, js, etc.
waitman.net - [19/Mar/2016:03:47:04 -0700] "GET
/wp-content/themes/mh-magazine-lite/style.css?ver=2.1.2 HTTP/1.1" 200
38550 "-"
After removing ?ver from html page, there was initial request:
waitman.net - [19/Mar/2016:03:50:15 -0700] "GET
/wp-content/themes/mh-magazine-lite/style.css HTTP/1.1" 200 38550 "-"
but after that it was served from cache and no more hits on origin.
Perhaps it was not doing a "full request", but I was looking at the
content length in the logs, 38550
>
>> Removing parameters from html allows the scripts to be cached, but I'm
>> wondering if there is a configuration to cache the scripts even with
>> parameter spec? In this case it's only a couple of minor modifications
>> to wp source, but it would be more convenient to avoid mod altogether.
>>
>> Also, I noticed that when requesting content through squid in proxy
>> mode
>> (not accel), with SSL request - a newline (\r\n) is appearing in the
>> header *before* the status, ie HTTP/1.1 200 OK. This does not happen
>> with http/80 requests. I haven't tested this thoroughly to be certain
>> that it's a problem in squid, but maybe you have an idea if it's
>> happening in the code? Something to consider. (Note: It could also be
>> a
>> problem with libcurl, if squid is not the culprit).
>
> Thats odd. Can you grab a packet trace between the two to figure that
> out?
Yes, I will check it out and see where the newline is coming from.
I'm in Boston for the LibrePlanet weekend but can check it out next
week.
>
>> version info:
>>
>> Squid Cache: Version 3.5.15-20160302-r14000
>> Service Name: squid
>> configure options: '--prefix=/usr/local/squid' '--with-openssl=/usr'
>> --enable-ltdl-convenience
>>
>> FreeBSD 10.2-RELEASE-p9 FreeBSD 10.2-RELEASE-p9 #0:
>>
>> Thanks,
>
--
Waitman Gobble
Los Altos CA USA
+1 650 900 8557
More information about the squid-users
mailing list