httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erica Zhang <erica...@cs.ubc.ca>
Subject Re: Questions on modules to provide cache functions for Apache
Date Wed, 07 Mar 2007 00:38:33 GMT
OK. For javascript file, I could find the files of Header and Data under 
the directory of mod_disk_cache. For php file, I could not find it. To 
enable you to get more details, you could access the simple application 
by yourself through http://128.189.138.12 (I am not sure if you could 
access it.) Also, I attach my http.conf, clienthint.js and gethint.php 
to this email.

I really do not know why it could not work. BTW: I deploy the Apache 
server on the Windows XP.

Regards,

Erica

David Wortham wrote:

> Erica,
>   I'm out of ideas.  I get the feeling that there's something you aren't
> telling us, but I feel that we have checked all the obvious points.
>
> I mis-typed the module name.  I meant mod_disk_cache when I said
> mod_file_cache.
>
> Dave
>
>
>
>
>
> On 3/6/07, Erica Zhang <ericazhj@cs.ubc.ca> wrote:
>
>>
>> David,
>>
>> 1) I tried /gethint.php without any GET/POST parameters. I got nothing
>> and it could not be cached even with force-caching directive. I do the
>> same thing for clienthint.js. It could work and display the source code
>> and could be cached.
>>
>> 2), The first part is the responses for clienthint.js:
>>
>> HTTP/1.x 200 OK
>> Date: Wed, 07 Mar 2007 00:05:08 GMT
>> Server: Apache/2.0.59 (Win32)
>> Last-Modified: Tue, 06 Mar 2007 01:57:50 GMT
>> *Etag: "88a26cc0-3ed-66b16380"*
>> *Accept-Ranges: bytes
>> Content-Length: 1005*
>> Keep-Alive: timeout=15, max=9999
>> Connection: Keep-Alive
>> *Content-Type: application/x-javascript*
>>
>> The second part is the response for gethint.php:
>>
>> HTTP/1.x 200 OK
>> Date: Wed, 07 Mar 2007 00:06:12 GMT
>> Server: Apache/2.0.59 (Win32)
>> X-Powered-By: PHP/4.4.4
>> Cache-Control: public
>> *Expires: Wed, 07 Mar 2007 00:16:12 GMT*
>> Last-Modified: Wed, 07 Mar 2007 00:06:12 GMT
>> Keep-Alive: timeout=15, max=10000
>> Connection: Keep-Alive
>> *Transfer-Encoding: chunked
>> Content-Type: text/html*
>>
>> I make the different header parts in bold.
>>
>> 3) Do you think I need to use mod_file_cache ? I do not use it.
>>
>> Regards,
>>
>> Erica
>>
>>
>> David Wortham wrote:
>>
>> > Erica,
>> >   My only comments: either
>> > (1) the request parameters are killing mod_cache's desire to cache the
>> > file
>> > or
>> > (2) something is different in the headers between your JavaScript and
>> PHP
>> > responses.
>> >
>> > I would:
>> > (1) Try requesting /gethint.php without any GET/POST parameters (your
>> app
>> > should respond with correctly formatted XML [probably returning an 
>> error
>> > code]).  Is this file cached (with/without the force-caching 
>> directive)?
>> > (2) Compare the javascript and xml response headers and compare any
>> > differences.  I would think forcing mod_cache to ignore all headers
>> would
>> > make this trivial... but this may reveal something which may be 
>> missing.
>> > (3) Clear your cache directory and see if your XML response creates a
>> > file,
>> > then check if your javascript file creates a cache file (assuming you
>> are
>> > still using mod_file_cache)
>> >
>> > Regards,
>> > Dave
>> >
>> >
>> > On 3/6/07, Erica Zhang <ericazhj@cs.ubc.ca> wrote:
>> >
>> >>
>> >> Yes. I changed the PHP script. Now I change them back and also set
>> >> CacheIgnoreCacheControl On. And still could not work. For other
>> >> questions, please see the my answers below. Thanks.
>> >>
>> >> David Wortham wrote:
>> >>
>> >> > Erica,
>> >> >   My observations of your headers:
>> >> > (1) The "Last-Modified" line contains the current timestamp (as
>> >> expected)
>> >>
>> >> After I set CacheIgnoreCacheControl On, it does not matter. Right ?
>> >> Although I move the headers to the top code, it still could not work.
>> >>
>> >> > (2) Your original question showed that you inserted an "Expires:"
>> >> header,
>> >> > but it doesn't show in your response.  Did you change your PHP 
>> script
>> >> > code
>> >> > since you asked the original question this morning?
>> >>
>> >> Yes. It is my fault.
>> >>
>> >> > (3) Are you returning XML or HTML?  My experience with
>> >> XMLHttpResponse(s)
>> >> > required changing the content-type to "text/xml" (not really the
>> issue
>> >> at
>> >> > hand)
>> >> >
>> >> Does it matter ?
>> >>
>> >> > When you said that you got mod_cache to cache a JavaScript file, 
>> was
>> >> > it in
>> >> > the same directory (and covered by the same mod_cache directives)?
>> >>
>> >> Yes, both javascript file and the php file are under htdocs 
>> directory.
>> >>
>> >> >
>> >> > Did you try using the
>> >> > CacheIgnoreCacheControl On
>> >> > directive?  Did it force the file to cache?
>> >>
>> >> I tried. But it could not work.
>> >>
>> >> >
>> >> > Regards,
>> >> > Dave
>> >> >
>> >> >
>> >> > On 3/6/07, Erica Zhang <ericazhj@cs.ubc.ca> wrote:
>> >> >
>> >> >>
>> >> >> I use live http headers to catch the headers. I listed them below.
>> >> Well
>> >> >> I found that php file has not been given the http headers. So is
>> this
>> >> >> the problem for not caching the response produced by it ? Then
how
>> >> can
>> >> I
>> >> >> handle this problem ? Also, is there some mod_cache log that I

>> could
>> >> >> refer ? Thanks.
>> >> >>
>> >> >> http://128.189.246.64/gethint.php?q=Eric&sid=0.11837499670287688
>> >> >>
>> >> >> GET /gethint.php?q=Eric&sid=0.11837499670287688 HTTP/1.1
>> >> >> Host: 128.189.246.64
>> >> >> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
>> >> rv:1.8.1.2)
>> >> >> Gecko/20070219 Firefox/2.0.0.2
>> >> >> 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
>> >> >> Referer: http://128.189.246.64/
>> >> >>
>> >> >> HTTP/1.x 200 OK
>> >> >> Date: Tue, 06 Mar 2007 22:35:34 GMT
>> >> >> Server: Apache/2.0.59 (Win32)
>> >> >> X-Powered-By: PHP/4.4.4
>> >> >> Cache-Control: public
>> >> >> Last-Modified: Tue, 06 Mar 2007 22:35:34 GMT
>> >> >> Keep-Alive: timeout=15, max=10000
>> >> >> Connection: Keep-Alive
>> >> >> Transfer-Encoding: chunked
>> >> >> Content-Type: text/html
>> >> >>
>> >> >>
>> >> >> Erica Zhang wrote:
>> >> >>
>> >> >> > Well, even I use the blinding-cache. It still could not work.
>> >> Thanks,
>> >> >> >
>> >> >> > Erica
>> >> >> >
>> >> >> > David Wortham wrote:
>> >> >> >
>> >> >> >> Erica,
>> >> >> >>   I'm not sure why mod_cache should not be able to work

>> (assuming
>> >> >> your
>> >> >> >> module and pages are configured correctly).
>> >> >> >>
>> >> >> >>   IIRC, JavaScript is used on the presentation request
(with 
>> the
>> >> >> >> webpage),
>> >> >> >> whereas the XMLHttpRequest response is a PHP-generated
XML
>> >> document.
>> >> >> >> Perhaps your extension ('.php" maybe?) or the mime/content-type
>> >> >> >> ("text/xml")
>> >> >> >> is what is causing mod_cache to skip the file?
>> >> >> >>
>> >> >> >>   Also, from what I can gather, using mod_cache with mod_proxy
>> >> (as a
>> >> >> >> caching proxy) can alter the effects of mod_cache slightly.
>> >> You may
>> >> >> >> want to
>> >> >> >> read up on that.
>> >> >> >>
>> >> >> >> Try using the following directive with mod_cache:
>> >> >> >> CacheIgnoreNoLastMod On
>> >> >> >>
>> >> >> >> see:
>> >> >> >>
>> >> >>
>> >>
>> http://webauth.stanford.edu/manual/mod/mod_cache.html#CacheIgnoreNoLastMod 
>>
>> >>
>> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> This apparently forces blind-caching which Joe suggests
is 
>> bad (I
>> >> >> >> don't know
>> >> >> >> anything about it).  Short of that, you just need to read
the
>> >> >> mod_cache
>> >> >> >> manual and make sure your XML response contains the necessary
>> >> headers
>> >> >> >> to get
>> >> >> >> mod_cache to work correctly.
>> >> >> >>
>> >> >> >> Regards,
>> >> >> >> Dave
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> On 3/6/07, Erica Zhang <ericazhj@cs.ubc.ca> wrote:
>> >> >> >>
>> >> >> >>>
>> >> >> >>> No, still not work. Infact, mod_cache could work,
because it
>> >> could
>> >> >> >>> cache
>> >> >> >>> the javascript. But it could not work for dynamic
HTTP 
>> responses
>> >> >> >>> responding to XMLHttpRequests in Ajax technology.
So I suspect
>> >> >> >>> mod_cache
>> >> >> >>> could not support this function. And I need provide
such
>> function
>> >> by
>> >> >> >>> myself. I prefer to do it in Apache, a comparatively

>> general way
>> >> >> >>> instead
>> >> >> >>> of application itself.
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> Erica
>> >> >> >>>
>> >> >> >>> Joachim Zobel wrote:
>> >> >> >>>
>> >> >> >>> >Am Montag, den 05.03.2007, 22:53 -0800 schrieb
Erica Zhang:
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >>> >>header("Cache-Control: public"); // HTTP/1.1
>> >> >> >>> >>header("Expires: " .gmdate ("D, d M Y H:i:s",
time() + 60 *
>> >> 10).
>> >> "
>> >> >> >>> GMT");
>> >> >> >>> >>header( "Last-Modified: " .gmdate( 'D, d M
Y H:i:s' ). "
>> >> GMT" );
>> >> >> >>> >>echo $response;
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>> >I am not shure about mod_caches behaviour, but
omitting
>> >> >> >>> last-modified is
>> >> >> >>> >worth a try.
>> >> >> >>> >
>> >> >> >>> >Sincerely,
>> >> >> >>> >Joachim
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >
>> >>
>> >>
>> >
>>
>>
>


Mime
View raw message