You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tony Anecito <ad...@yahoo.com> on 2011/02/02 18:06:39 UTC

[users@httpd] Browser, Apache and caching...

Hi All,

I am wondering for the browser cache to work does the expires headers in the 
apache config file have to be setup? Or by default when the page request from 
the browser hits apache does it look at the file modified time stamp for the 
file on disk or Apache cache and compares to whatever the request has in it (I 
assume a file timestamp)?

Just trying to figure out if expires header is really needed because if you use 
it by setting a future date then the only way to get the file sent across due to 
some change is to rename it slightly.

Thanks,
-Tony


      

---------------------------------------------------------------------
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] Browser, Apache and caching...

Posted by Igor Galić <i....@brainsware.org>.
----- "Tony Anecito" <ad...@yahoo.com> wrote:

> Hi Tom,
> 
> So for the If-Last-Modified header it has to go all the way back to
> the origin
> server and not stop at the browser cache or proxy server correct? The
> Proxy does
> not periodically (async) check the origin server? Whereas for the

This highly depends on the Proxy (Cache) in question.

> Expires header
> it will not go to the origin server but rather than the browser or
> proxy if the
> time has not expired for that file.
> 
> Thanks for the prompt reply.
> -Tony
> 
> 
> 
> ----- Original Message ----
> From: Tom Evans <te...@googlemail.com>
> To: users@httpd.apache.org
> Sent: Wed, February 2, 2011 10:47:41 AM
> Subject: Re: [users@httpd] Browser, Apache and caching...
> 
> On Wed, Feb 2, 2011 at 5:06 PM, Tony Anecito <ad...@yahoo.com>
> wrote:
> > Hi All,
> >
> > I am wondering for the browser cache to work does the expires
> headers in the
> > apache config file have to be setup? Or by default when the page
> request from
> > the browser hits apache does it look at the file modified time stamp
> for the
> > file on disk or Apache cache and compares to whatever the request
> has in it (I
> > assume a file timestamp)?
> >
> > Just trying to figure out if expires header is really needed because
> if you
> use
> > it by setting a future date then the only way to get the file sent
> across due
> >to
> > some change is to rename it slightly.
> >
> > Thanks,
> > -Tony
> >
> 
> Correct, sending an Expires header will make UA caches store the
> object unconditionally until it gets ejected or the date specified is
> reached.
> 
> Instead of sending Expires, if you send a Last-Modified header (which
> will happen by default for files served from disk by Apache), then the
> next time the UA requests that, it should add a header
> If-Modified-Since header. If the file hasn't been modified since that
> time, then Apache will send an empty 304 response (Not Modified), and
> the UA will serve from cache.
> 
> Cheers
> 
> Tom
> 
> ---------------------------------------------------------------------
> 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

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.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


Re: [users@httpd] Browser, Apache and caching...

Posted by Tony Anecito <ad...@yahoo.com>.
Hi Tom,

So for the If-Last-Modified header it has to go all the way back to the origin 
server and not stop at the browser cache or proxy server correct? The Proxy does 
not periodically (async) check the origin server? Whereas for the Expires header 
it will not go to the origin server but rather than the browser or proxy if the 
time has not expired for that file.

Thanks for the prompt reply.
-Tony



----- Original Message ----
From: Tom Evans <te...@googlemail.com>
To: users@httpd.apache.org
Sent: Wed, February 2, 2011 10:47:41 AM
Subject: Re: [users@httpd] Browser, Apache and caching...

On Wed, Feb 2, 2011 at 5:06 PM, Tony Anecito <ad...@yahoo.com> wrote:
> Hi All,
>
> I am wondering for the browser cache to work does the expires headers in the
> apache config file have to be setup? Or by default when the page request from
> the browser hits apache does it look at the file modified time stamp for the
> file on disk or Apache cache and compares to whatever the request has in it (I
> assume a file timestamp)?
>
> Just trying to figure out if expires header is really needed because if you 
use
> it by setting a future date then the only way to get the file sent across due 
>to
> some change is to rename it slightly.
>
> Thanks,
> -Tony
>

Correct, sending an Expires header will make UA caches store the
object unconditionally until it gets ejected or the date specified is
reached.

Instead of sending Expires, if you send a Last-Modified header (which
will happen by default for files served from disk by Apache), then the
next time the UA requests that, it should add a header
If-Modified-Since header. If the file hasn't been modified since that
time, then Apache will send an empty 304 response (Not Modified), and
the UA will serve from cache.

Cheers

Tom

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


Re: [users@httpd] Browser, Apache and caching...

Posted by Tom Evans <te...@googlemail.com>.
On Wed, Feb 2, 2011 at 5:06 PM, Tony Anecito <ad...@yahoo.com> wrote:
> Hi All,
>
> I am wondering for the browser cache to work does the expires headers in the
> apache config file have to be setup? Or by default when the page request from
> the browser hits apache does it look at the file modified time stamp for the
> file on disk or Apache cache and compares to whatever the request has in it (I
> assume a file timestamp)?
>
> Just trying to figure out if expires header is really needed because if you use
> it by setting a future date then the only way to get the file sent across due to
> some change is to rename it slightly.
>
> Thanks,
> -Tony
>

Correct, sending an Expires header will make UA caches store the
object unconditionally until it gets ejected or the date specified is
reached.

Instead of sending Expires, if you send a Last-Modified header (which
will happen by default for files served from disk by Apache), then the
next time the UA requests that, it should add a header
If-Modified-Since header. If the file hasn't been modified since that
time, then Apache will send an empty 304 response (Not Modified), and
the UA will serve from cache.

Cheers

Tom

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