finding the reason why an object is cached or not...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

finding the reason why an object is cached or not...

Anton Melser
Hi,
I am trying to understand why certain objects are cached and others
not (in a web accelerator setup). For example, squid is caching
http://my.site.org/images/hello.gif
but not
http://my.site.org/js/hello.js
Both files are well under any limits (< 2KB)
But for another site, pretty much everything is getting cached, i.e.,
http://my.othersite.org/images/hello.gif
and
http://my.othersite.org/js/hello.js
are giving hits.
The only difference I could see in the headers (as reported via the
firefox plugin httpheaders) is that the first js is gzipped. Could
that be it? I tried disabling the apache gzip exclusion thingie
#acl apache rep_header Server ^Apache
#broken_vary_encoding allow apache
But that didn't seem to change anything. Does anyone have any pointers?
Cheers
Anton
Reply | Threaded
Open this post in threaded view
|

Re: finding the reason why an object is cached or not...

Anton Melser
On 17/05/07, Anton Melser <[hidden email]> wrote:

> Hi,
> I am trying to understand why certain objects are cached and others
> not (in a web accelerator setup). For example, squid is caching
> http://my.site.org/images/hello.gif
> but not
> http://my.site.org/js/hello.js
> Both files are well under any limits (< 2KB)
> But for another site, pretty much everything is getting cached, i.e.,
> http://my.othersite.org/images/hello.gif
> and
> http://my.othersite.org/js/hello.js
> are giving hits.
> The only difference I could see in the headers (as reported via the
> firefox plugin httpheaders) is that the first js is gzipped. Could
> that be it? I tried disabling the apache gzip exclusion thingie
> #acl apache rep_header Server ^Apache
> #broken_vary_encoding allow apache
> But that didn't seem to change anything. Does anyone have any pointers?
> Cheers
> Anton

Here is what httpheaders gives

http://www.my.domain.name/js/general.js

GET /js/general.js HTTP/1.1
Host: www.my.domain.name
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: Wysistat=0.9275272298400944_1179412290656%A72%A71179412348937%A72%A71179398121%A70.9578866789309586_1179398121265;
PHPSESSID=27ed1a75d667f05cc961ff76df8bee61

HTTP/1.x 200 OK
Date: Thu, 17 May 2007 15:31:02 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5
PHP/5.0.5-1 mod_perl/1.999.21 Perl/v5.8.7
X-Powered-By: PHP/5.0.5-1
Set-Cookie: PHPSESSID=27ed1a75d667f05cc961ff76df8bee61; path=/
Expires: Sat, 19 May 2007 17:31:02 GMT
Cache-Control: private
Pragma: cache
Last-Modified: 28/04/2006 17:22
Accept-Ranges: bytes
Content-Encoding: gzip
Vary: Accept-Encoding
Etag: "dd4dd40f580d39ccada206547449762b-1378461273"
Content-Length: 796
Content-Type: text/javascript
X-Cache: MISS from sub.my.domain.name
X-Cache-Lookup: MISS from sub.my.domain.name:80
Via: 1.0 sub.my.domain.name:80 (squid/2.6.STABLE5)
Connection: keep-alive
X-Antivirus: avast! 4
X-Antivirus-Status: Clean
----------------------------------------------------------
... (favicons removed)

http://sub.my.domain.name/outline/js/outline.js

GET /outline/js/outline.js HTTP/1.1
Host: sub.my.domain.name
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: Wysistat=0.12772142043000478_1179404772640%uFFFD2%uFFFD1179404903875%uFFFD2%uFFFD1179396774%uFFFD0.9420937600452932_1179396774750;
LangCookie=fr

HTTP/1.x 200 OK
Date: Thu, 17 May 2007 13:24:46 GMT
Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4
PHP/5.2.0-8+etch1c2c1 mod_perl/2.0.2 Perl/v5.8.8
Last-Modified: Thu, 26 Apr 2007 09:27:14 GMT
Etag: "2c611-b70-9fc78080"
Accept-Ranges: bytes
Content-Length: 2928
Content-Type: application/x-javascript
Age: 11403
X-Cache: HIT from sub.my.domain.name
X-Cache-Lookup: HIT from sub.my.domain.name:80
Via: 1.0 sub.my.domain.name:80 (squid/2.6.STABLE5)
Connection: keep-alive
X-Antivirus: avast! 4
X-Antivirus-Status: Clean
----------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Re: finding the reason why an object is cached or not...

Henrik Nordström
tor 2007-05-17 klockan 17:43 +0200 skrev Anton Melser:

> Here is what httpheaders gives
>
> http://www.my.domain.name/js/general.js
>
> GET /js/general.js HTTP/1.1

> HTTP/1.x 200 OK
> Date: Thu, 17 May 2007 15:31:02 GMT
> Set-Cookie: PHPSESSID=27ed1a75d667f05cc961ff76df8bee61; path=/

A bit dangerous to have on cachable content..

> Expires: Sat, 19 May 2007 17:31:02 GMT
> Last-Modified: 28/04/2006 17:22

The above Last-Modified date is not a valid HTTP date. Shouldn't make a
difference as there is an explicit Expires header but..

> Vary: Accept-Encoding

Have you perhaps disabled caching of Vary:ing content? See the
cache_vary directive.

Regards
Henrik

signature.asc (316 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: finding the reason why an object is cached or not...

Amos Jeffries
Administrator
In reply to this post by Anton Melser
Anton Melser wrote:

> On 17/05/07, Anton Melser <[hidden email]> wrote:
>> Hi,
>> I am trying to understand why certain objects are cached and others
>> not (in a web accelerator setup). For example, squid is caching
>> http://my.site.org/images/hello.gif
>> but not
>> http://my.site.org/js/hello.js
>> Both files are well under any limits (< 2KB)
>> But for another site, pretty much everything is getting cached, i.e.,
>> http://my.othersite.org/images/hello.gif
>> and
>> http://my.othersite.org/js/hello.js
>> are giving hits.
>> The only difference I could see in the headers (as reported via the
>> firefox plugin httpheaders) is that the first js is gzipped. Could
>> that be it? I tried disabling the apache gzip exclusion thingie
>> #acl apache rep_header Server ^Apache
>> #broken_vary_encoding allow apache
>> But that didn't seem to change anything. Does anyone have any pointers?
>> Cheers
>> Anton
>
> Here is what httpheaders gives
>
> http://www.my.domain.name/js/general.js
>
> GET /js/general.js HTTP/1.1
> Host: www.my.domain.name

<snip other headers>

>
> HTTP/1.x 200 OK
> Date: Thu, 17 May 2007 15:31:02 GMT
> Server: Apache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5
> PHP/5.0.5-1 mod_perl/1.999.21 Perl/v5.8.7
> X-Powered-By: PHP/5.0.5-1
> Set-Cookie: PHPSESSID=27ed1a75d667f05cc961ff76df8bee61; path=/

These would be the problem:

> Expires: Sat, 19 May 2007 17:31:02 GMT
> Cache-Control: private
> Pragma: cache
<snip other headers>

Apparently the "private" is a show-stopper cache control action,
preventing secure data from being stored.

Amos