You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by gregory duchesnes <gr...@icilalune.com> on 2005/11/21 12:20:30 UTC

[users@httpd] can't get mod_expires to work with apache 2.0.54

I all,

i'm trying to make mod_expires work on my server (Debian stable).

First i tried to make it work serverwide (just for testing) I then added 
those two lines in my main conf file :

ExpiresActive On
ExpiresDefault "now plus 1 seconds"
# i also tried this
ExpiresDefault A1

But it does not change anything, my browser (Firefox 1.0.7) first get 
the file normally from the server, but if i close the browser and try 
and grab the file again, i get a HTTP 304 not modified code instead of 
the HTTP 200 code i expected.
Furthermore, the "If-Modified-Since" header still sends the last 
modification time of the file instead of last access+1 second.

I also tried in an .htaccess (with AllowOverride Indexes) file without 
success.



What shall i do to make this module work?

---------------------------------------------------------------------
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] can't get mod_expires to work with apache 2.0.54

Posted by gerard such <ge...@gmail.com>.
I had the same problem when i tried to disable cache through mod_perl2
own modules. In my case the Cache-Control headers solution pointed
here was not sufficient.
I followed the http headers through the firefox popular extension and
what i saw was that the important "tags" the browser was looking at
were:

If-Modified-Since: Tue, 05 Jul 2005 06:25:08 GMT
If-None-Match: "1bcbb8-ca-25467900"

And although the files were indeed modified, the system was not
responding as desired. As an example i attach a complet HTTP
negotiation:

http://localhost/camandules.info/
GET /camandules.info/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12)
Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7)
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: ###
blogum_counter_sesion=1
If-Modified-Since: Tue, 05 Jul 2005 06:25:08 GMT
If-None-Match: "1bcbb8-ca-25467900"


HTTP/1.x 304 Not Modified
Date: Sun, 13 Nov 2005 19:00:52 GMT
Server: mod-xslt/1.3.8 Apache/2.0.55 (Unix)
mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.1 Perl/v5.8.7
Connection: Keep-Alive
Keep-Alive: timeout=15, max=100
Etag: "1bcbb8-ca-25467900"
Expires: -1
Cache-Control: max-age=0, no-cache, must-revalidate
--------------------------------------------------------


It's important to note that the ETAG was disabled by the directive "FileETag
None" (obvioulsy it wasn't working).

What i finally do (thanks to mp2 mailinglist) was to erase the input
headers (not the output) If-Modified-Since and If-None-Match, then
everything appears to work as desired.













2005/11/21, gregory duchesnes <gr...@icilalune.com>:
> Thanks for your answer Nick,
>
> i still don't understand what mod_expires stand for, but anyway i solved
> my problem sending custom "no-cache" headers thanks to mod_headers, and
> i work like a charm :
>
> Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT"
> Header set Cache-Control "no-store, no-cache, must-revalidate"
> Header set Pragma "no-cache"
>
>
> Nick Kew a écrit :
>
> >On Monday 21 November 2005 11:36, gregory duchesnes wrote:
> >
> >
> >>Therefore i didn't understand what mod_expires does!?
> >>
> >>That mechanism i correct in case i don't use mod_expires, but i want to
> >>invalidate cache as soon as the client gets the file.
> >>
> >>
> >
> >You can invalidate the cache as much as you like (I haven't checked your
> >use of mod_expires).  But that doesn't stop a browser using the cache if it's
> >configured to do so.  Your browser very sensibly checks with the server first.
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>


--
(signatura)
Eps, el meu bloc personal
http://www.camandules.info

---------------------------------------------------------------------
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] can't get mod_expires to work with apache 2.0.54

Posted by gregory duchesnes <gr...@icilalune.com>.
Thanks for your answer Nick,

i still don't understand what mod_expires stand for, but anyway i solved 
my problem sending custom "no-cache" headers thanks to mod_headers, and 
i work like a charm :

Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate"
Header set Pragma "no-cache"


Nick Kew a écrit :

>On Monday 21 November 2005 11:36, gregory duchesnes wrote:
>  
>
>>Therefore i didn't understand what mod_expires does!?
>>
>>That mechanism i correct in case i don't use mod_expires, but i want to
>>invalidate cache as soon as the client gets the file.
>>    
>>
>
>You can invalidate the cache as much as you like (I haven't checked your
>use of mod_expires).  But that doesn't stop a browser using the cache if it's
>configured to do so.  Your browser very sensibly checks with the server first.
>
>
>  
>

---------------------------------------------------------------------
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] can't get mod_expires to work with apache 2.0.54

Posted by Nick Kew <ni...@webthing.com>.
On Monday 21 November 2005 11:36, gregory duchesnes wrote:
> Therefore i didn't understand what mod_expires does!?
>
> That mechanism i correct in case i don't use mod_expires, but i want to
> invalidate cache as soon as the client gets the file.

You can invalidate the cache as much as you like (I haven't checked your
use of mod_expires).  But that doesn't stop a browser using the cache if it's
configured to do so.  Your browser very sensibly checks with the server first.


-- 
Nick Kew

---------------------------------------------------------------------
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] can't get mod_expires to work with apache 2.0.54

Posted by gregory duchesnes <gr...@icilalune.com>.
Therefore i didn't understand what mod_expires does!?

That mechanism i correct in case i don't use mod_expires, but i want to 
invalidate cache as soon as the client gets the file.
Did i misread mod_expires documentation? What mod_expires is used for then?

Nick Kew a écrit :

>On Monday 21 November 2005 11:20, gregory duchesnes wrote:
>
>  
>
>>But it does not change anything, my browser (Firefox 1.0.7) first get
>>the file normally from the server, but if i close the browser and try
>>and grab the file again, i get a HTTP 304 not modified code instead of
>>the HTTP 200 code i expected.
>>    
>>
>
>That's correct.  Your browser asked the server whether the document
>has changed, and the server replied that it hasn't.  That's exactly how
>HTTP is supposed to work.
>
>If you had a long expiry time, your browser might have optimised
>further by reusing its cached copy without bothering to ask the server.
>
>  
>

---------------------------------------------------------------------
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] can't get mod_expires to work with apache 2.0.54

Posted by Nick Kew <ni...@webthing.com>.
On Monday 21 November 2005 11:20, gregory duchesnes wrote:

> But it does not change anything, my browser (Firefox 1.0.7) first get
> the file normally from the server, but if i close the browser and try
> and grab the file again, i get a HTTP 304 not modified code instead of
> the HTTP 200 code i expected.

That's correct.  Your browser asked the server whether the document
has changed, and the server replied that it hasn't.  That's exactly how
HTTP is supposed to work.

If you had a long expiry time, your browser might have optimised
further by reusing its cached copy without bothering to ask the server.

-- 
Nick Kew

---------------------------------------------------------------------
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