You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Erica Zhang <er...@cs.ubc.ca> on 2007/03/06 02:25:46 UTC

[users@httpd] How to cache the responses for XMLHttpRquest

Hi,
I want to cache the responses for XMLHttpRequest, that is dynamic 
content. I have configureed http.conf using Expires to add headers to 
those responses. However, I still could not find those responses to be 
able to be cached by use of web browser (Firefox 2.0).
Also, I tried to add Header to enable Cache-Control and etc. However 
they could not work either.
So I am not sure if there is a way to cache XMLHttpRequest.
Thanks,
Erica

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to cache the responses for XMLHttpRquest

Posted by matt farey <ma...@gmail.com>.

Pid wrote:
> Erica Zhang wrote:
>> Hi,
>> I want to cache the responses for XMLHttpRequest, that is dynamic
>> content. I have configureed http.conf using Expires to add headers to
>> those responses. However, I still could not find those responses to
>> be able to be cached by use of web browser (Firefox 2.0).
>> Also, I tried to add Header to enable Cache-Control and etc. However
>> they could not work either.
>> So I am not sure if there is a way to cache XMLHttpRequest.
>> Thanks,
>> Erica
>
> Apache doesn't know that a given request is an XMLHttpRequest - it's
> no different from a normal request.
>
> Are the requests that you're making identical each time?
> Can you post some examples of the URL that's being requested?
>
> What does your access_log say, e.g. is it returning 200 for each request?
>
>
> p
>
>
>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
might also be worth reading this:
http://www.mnot.net/cache_docs/
http://www.mooreds.com/wordpress/archives/000382
the 2nd of which has links to caching support in browsers
Basically it is possible, driven by the browser, and different headers
take priority, and you have to code your application to use caching,
sending if-modified0since and sometimes other headers in order to get
the deisired response, use a proxy to discover what your browser says to
the server, and replicate that in your xhr calls.

-- 
Matthew Farey



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to cache the responses for XMLHttpRquest

Posted by Pid <p...@pidster.com>.
Erica Zhang wrote:
> Hi,
> I want to cache the responses for XMLHttpRequest, that is dynamic 
> content. I have configureed http.conf using Expires to add headers to 
> those responses. However, I still could not find those responses to be 
> able to be cached by use of web browser (Firefox 2.0).
> Also, I tried to add Header to enable Cache-Control and etc. However 
> they could not work either.
> So I am not sure if there is a way to cache XMLHttpRequest.
> Thanks,
> Erica

Apache doesn't know that a given request is an XMLHttpRequest - it's no 
different from a normal request.

Are the requests that you're making identical each time?
Can you post some examples of the URL that's being requested?

What does your access_log say, e.g. is it returning 200 for each request?


p



> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org