Skip to contentSkip to conversation

apache 2 expiresdefault

DISCUSSION Jake Ravenwood 3 participants 5 messages Jul 8, 2008 – Jul 9, 2008

lore
Share & tools
lore
#0 lore raw

hi,
i have a linux/apache2 newly setup. i put it online last week but after a day, i got a lot of email/phone complaints saying they are seeing old pages/old contents of the site. My site changes frequently(daily). after checking i found that apache has ExpiresDefault A2419200 which spells to 28days. I changed it to ExpiresDefault A0 and reload Apache. Some end-users are now seeing the new content but some are still seeing the old pages. What else i missed?

thanks,
jake

#1 lore raw
Quoted 8 lines · Jake Ravenwood

i have a linux/apache2 newly setup. i put it online last week but after a day, i got a lot of email/phone complaints saying they are seeing old pages/old contents of the site. My site changes frequently(daily). after checking i found that apache has ExpiresDefault A2419200 which spells to 28days. I changed it to ExpiresDefault A0 and reload Apache. Some end-users are now seeing the new content but some are still seeing the old pages. What else i missed?

If someone already has a cached version with the 28-day expiry, their web browser (or an intermediate proxy) is likely to keep using it until it expires or until they force a reload. Nothing you do to your web server can force those existing copies to expire prematurely.

Signature · 1 line
Glynn Clements <[email protected]>
#2 lore raw
Quoted 11 lines · Glynn Clements
Quoted 8 lines · Jake Ravenwood

i have a linux/apache2 newly setup. i put it online last week but after a day, i got a lot of email/phone complaints saying they are seeing old pages/old contents of the site. My site changes frequently(daily). after checking i found that apache has ExpiresDefault A2419200 which spells to 28days. I changed it to ExpiresDefault A0 and reload Apache. Some end-users are now seeing the new content but some are still seeing the old pages. What else i missed?

Quoted 5 lines

If someone already has a cached version with the 28-day expiry, their web browser (or an intermediate proxy) is likely to keep using it until it expires or until they force a reload. Nothing you do to your web server can force those existing copies to expire prematurely.

hi Jake,
try adding those meta tags to your (x)html files (into the head part of course):

<meta http-equiv="expires" content="-1"> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache">

this won't force your clients to reload the page, but it should suppress future caching. it's just html, so sure not every browser will interpret that.

#3 lore raw

I am still looking on how to have their browsers/proxy server to refresh soon. or trick their browser that there is new content already so they need to get the new copy.

i am thinking of changing the directoryindex and point to index.php -such that it changes the inode,mtime and filesize. then inside index.php i have:
<?
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

call_the_original_html_file.

?>

how to i call the original html file from index.php? i mean, index.php will load first then it will call/load html file.

thanks,
jake

Quoted 56 lines · Hubert Grzeskowiak

From: Hubert Grzeskowiak <[email protected]>
Subject: Re: apache 2 expiresdefault
To:
Date: Wednesday, July 9, 2008, 4:17 AM

Quoted 3 lines · Glynn Clements
Quoted 1 line · Jake Ravenwood

i have a linux/apache2 newly setup. i put it

online last week but

Quoted 1 line
Quoted 1 line

after a day, i got a lot of email/phone complaints

saying they are

Quoted 1 line
Quoted 1 line

seeing old pages/old contents of the site. My site

changes

Quoted 1 line
Quoted 1 line

frequently(daily). after checking i found that

apache has

Quoted 1 line
Quoted 1 line

ExpiresDefault A2419200 which spells to 28days. I

changed it to

Quoted 1 line
Quoted 1 line

ExpiresDefault A0 and reload Apache. Some

end-users are now seeing the

Quoted 1 line
Quoted 1 line

new content but some are still seeing the old

pages. What else i

Quoted 3 lines
Quoted 1 line

missed?

If someone already has a cached version with the

28-day expiry, their

Quoted 1 line

web browser (or an intermediate proxy) is likely to

keep using it

Quoted 1 line

until it expires or until they force a reload. Nothing

you do to your

Quoted 1 line

web server can force those existing copies to expire

prematurely.

Quoted 1 line

hi Jake,
try adding those meta tags to your (x)html files (into the head part of
course):

<meta http-equiv="expires"
content="-1">
<meta http-equiv="pragma"
content="no-cache">
<meta http-equiv="cache-control"
content="no-cache">

this won't force your clients to reload the page, but it should suppress
future caching. it's just html, so sure not every browser will interpret
that.
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 13 lines · Jake Ravenwood

I am still looking on how to have their browsers/proxy server to refresh soon. or trick their browser that there is new content already so they need to get the new copy.

i am thinking of changing the directoryindex and point to index.php -such that it changes the inode,mtime and filesize. then inside index.php i have:

<?
header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");

Quoted 6 lines

call_the_original_html_file.

?>

how to i call the original html file from index.php? i mean, index.php will load first then it will call/load html file.

There is no need for that; if the browser/proxy is actually checking with your server, you can just use "touch" on the file/directory to update the timestamp. This will affect the Last-Modified header, and cause any If-Modified-Since test to succeed (i.e. the "new" data will be returned rather than just a 304 "Not Modified" response).

However, the same issue will affect all pages. Nothing in the headers (or http-equiv tags) for one page will affect the expiry status of other pages which have been cached. The only solution there is to rename all of the links (e.g. change .html -> .htm, change the case of the first letter, etc) so that the content appears to be new.

Signature · 1 line
Glynn Clements <[email protected]>