RE: [users@httpd] "Expires" and "Cache-Control" don't work properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Actually "Expires" and "Cache-Control" do work properly. Don't you see those headers in the response received by your browser? Are the elements cached by your browser?
 
I believe that the behaviour you observe may be due to the order in which mod_header and mod_cache process the response. My guess is that mod_headers intervenes on the response after mod_cache. At the time the responses are processed by mod_cache, the "Expires" and "Cache-Control" headers have not yet been inserted.
 
If you are using mod_disk_cache you can verify this by browsing one of the .header files created in the cache directory. If those files do not contain the "Expires" and "Cache-Control" headers, chances are that these headers are inserted into the response after having been processed by mod_cache.
 
Your configuration is not very consistent either since you on one hand set "ExpiresActive On", and on the other explicitly do "Header set" and "Header unset" on files for which you have defined "ExpireByType". 
 
If the pages are generated "on the fly", why don't you have the application set the apropriate headers??
 
If the pages are generated "on the fly", they probably do not have LastModified, ETag or Expires headers. If that is the case, they will not be cache by Apache (no cache validator).

If I am right about the order in which the different modules/filters are processed, and you cannot have the application set the correct headers, you will probably need to make a two-stage rocket, i.e. two virtual hosts where the frontal is a caching reverse proxy whose task is to forward requests to the backend and cache responses if they are cacheable, and the backend takes care of inserting the correct headers. I would also take a little different approach wrt.the configuration and try something like this:


ExpiresDefault "now"                                                                                           
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css  A2592000

ExpiresActive on

<LocationMatch "!\.(css|jpe?g|png|css|sav)$">
    Header set Pragma "no-cache"
    Header set Cache-Control "no-cache, must-revalidate"
</LocationMatch>

-ascs
________________________________

From: Diana Horvitz [mailto:Diana.Horvitz@xxxxxxxxxxxxxx] 
Sent: Sunday, May 08, 2005 10:27 AM
To: 'users@xxxxxxxxxxxxxxxx'
Subject: [users@httpd] "Expires" and "Cache-Control" don't work properly



Hi,

 

I have a system in which all the pages are generated on the fly.

I want those pages not to be cached. I do want to cache images and css files.

 

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux