You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Ames <gr...@remulak.net> on 2002/01/22 16:59:30 UTC
Expires: header prevents caching
I tested the URL that Andrzej mentions below. Sho 'nuf, the value of the
Expires: headers we send is exactly the same as the value of the Date: header.
RFC 2616 says the content can't be cached by proxies in this case.
[gregames@gandalf gregames]$ runsocks nc httpd.apache.org 80
HEAD /docs/mod/core.html HTTP/1.0
host: httpd.apache.org
HTTP/1.1 200 OK
Date: Tue, 22 Jan 2002 15:34:16 GMT
Server: Apache/2.0.29 (Unix)
Content-Location: core.html.en
Vary: negotiate,accept-language
TCN: choice
Accept-Ranges: bytes
Connection: close
Content-Type: text/html
Content-Language: en
Expires: Tue, 22 Jan 2002 15:34:16 GMT
but for many other URLs, we don't bother with the Expires: header
[gregames@gandalf gregames]$ runsocks nc httpd.apache.org 80
HEAD /index.html HTTP/1.0
host: httpd.apache.org
HTTP/1.1 200 OK
Date: Tue, 22 Jan 2002 15:44:37 GMT
Server: Apache/2.0.29 (Unix)
Accept-Ranges: bytes
Content-Length: 6139
Connection: close
Content-Type: text/html
Does anyone understand the care and feeding of Expires: headers in Apache?
Seems like it would be in our best interest to allow caching for most/all static
pages.
Thanks,
Greg
-------- Original Message --------
Subject: Two things (fwd)
Date: Mon, 21 Jan 2002 09:39:05 -0800 (PST)
From: Brian Behlendorf <br...@collab.net>
To: trawick@apache.org, <gr...@apache.org>
Notice the 2nd issue.
Brian
---------- Forwarded message ----------
Date: Mon, 21 Jan 2002 12:55:17 +0100
From: Andrzej Kukula <An...@navopgd.pl>
To: webmaster@apache.org
Subject: Two things
Hello.
I've got just two annoying things:
1. On www.apache.org, httpd.apache.org there's no mention on a general
contact concerning the Web Page, so I'm sending this message to well-known
address.
2. (Far more important) httpd.apache.org transmits the same Date: and
Expires: HTTP headers, thus making squid unable to cache your pages. I've
tested it with httpd.apache.org/docs/mod/core.html.
Regards,
Andrzej Kuku³a
Re: Expires: header prevents caching
Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Tue, Jan 22, 2002 at 01:50:58PM -0600, William A. Rowe, Jr. wrote:
> > I'm no protcol expert, but that doesn't make sense to me. mod_negotiation
> > should be adding "Accept-Language" to the Vary: header (yep, it's doing
> > that), but it shouldn't be setting Expires, should it? Proxies should be
> > free to cache the page, conditional on the Accept-Language.
>
> Which proxies?
>
> HTTP/1.1 proxies, yes, should be able to serve based on Vary: recognition.
>
> HTTP/1.0 proxies, no, cannot do that. We should add [if it's not already
> present] the appropriate conditions in that reset.
But you wouldn't defeat everything HTTP/1.1 has brought us, cache-wise,
only for being backwards compatible until 1992?
It has always been like that: a caching proxy which ignores both
Content-Location and Vary: WILL be caching the first copy it gets, and
will ignore client's Accept-Language headers on subsequent requests.
That's life, and it makes no sense to become a cache-pig for that.
(That does not mean BTW that every HTTP/1.0 cache behaves so badly.
Many honor these headers, even if they say they speak HTTP/1.0 only).
Worse: even if a site decides it wants to become a cache-pig, then
it's the site's decision.
But Apache, as reference inplementation for HTTP/1.1, should *NEVER*
hard-code such a stupidity into the server. That's just plain wrong.
Yes, mod_negotiate should supply the Vary: and Content-*: headers for
the page, and if it is a truly dynamic page (which a negotiated set
of static documents isn't), only then should it omit the Last-Modified
header (or set it to now?). But setting Expires: is a configurative
decision of the pages' author, it must not be a decision of the server.
Just my $ .02
Martin
--
<Ma...@Fujitsu-Siemens.com> | Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-47655 | 81730 Munich, Germany
RE: Expires: header prevents caching
Posted by Joshua Slive <jo...@slive.ca>.
> From: William A. Rowe, Jr. [mailto:wrowe@covalent.net]
> > I'm no protcol expert, but that doesn't make sense to me.
> mod_negotiation
> > should be adding "Accept-Language" to the Vary: header (yep, it's doing
> > that), but it shouldn't be setting Expires, should it? Proxies
> should be
> > free to cache the page, conditional on the Accept-Language.
>
> Which proxies?
>
> HTTP/1.1 proxies, yes, should be able to serve based on Vary: recognition.
>
> HTTP/1.0 proxies, no, cannot do that. We should add [if it's not already
> present] the appropriate conditions in that reset.
>
Yes, you're right. But at the moment, we are getting Expires for ALL
requests. That's not good, in my opinion. That will prevent even HTTP/1.1
clients/proxies from caching.
Joshua.
Re: Expires: header prevents caching
Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
From: "Joshua Slive" <jo...@slive.ca>
Sent: Tuesday, January 22, 2002 1:32 PM
> > From: gregames@Mail.MeepZor.Com [mailto:gregames@Mail.MeepZor.Com]On
> > Behalf Of Greg Ames
>
> > OK, I see what's happening:
> >
> > [gregames@daedalus apache]$ ls /www/httpd.apache.org/docs/mod/core*
> > /www/httpd.apache.org/docs/mod/core.html.en
> > /www/httpd.apache.org/docs/mod/core.html.fr
> > /www/httpd.apache.org/docs/mod/core.html.html
> >
> > mod_negotiation is turning off caching because there are multiple
> > versions of
> > that document. We wouldn't want squid to cache an English version of the
> > document and serve it to a French client.
>
> I'm no protcol expert, but that doesn't make sense to me. mod_negotiation
> should be adding "Accept-Language" to the Vary: header (yep, it's doing
> that), but it shouldn't be setting Expires, should it? Proxies should be
> free to cache the page, conditional on the Accept-Language.
Which proxies?
HTTP/1.1 proxies, yes, should be able to serve based on Vary: recognition.
HTTP/1.0 proxies, no, cannot do that. We should add [if it's not already
present] the appropriate conditions in that reset.
RE: Expires: header prevents caching
Posted by Joshua Slive <jo...@slive.ca>.
> From: gregames@Mail.MeepZor.Com [mailto:gregames@Mail.MeepZor.Com]On
> Behalf Of Greg Ames
> and yes, HTTP version does make a difference:
Yes, you are right. My test was flawed. Everything seems to be working
properly.
Joshua.
Re: Expires: header prevents caching
Posted by Greg Ames <gr...@remulak.net>.
Joshua Slive wrote:
> I'm no protcol expert, but that doesn't make sense to me. mod_negotiation
> should be adding "Accept-Language" to the Vary: header (yep, it's doing
> that), but it shouldn't be setting Expires, should it? Proxies should be
> free to cache the page, conditional on the Accept-Language.
Here's the chunk of code from mod_negotiation:
if ((!do_cache_negotiated_docs(r->server)
&& (r->proto_num < HTTP_VERSION(1,1)))
&& neg->count_multiviews_variants != 1) {
r->no_cache = 1;
}
and yes, HTTP version does make a difference:
[gregames@gandalf gregames]$ runsocks nc httpd.apache.org 80
HEAD /docs/mod/core.html HTTP/1.1
host: httpd.apache.org
HTTP/1.1 200 OK
Date: Tue, 22 Jan 2002 19:46:47 GMT
Server: Apache/2.0.29 (Unix)
Content-Location: core.html.en
Vary: negotiate,accept-language
TCN: choice
Accept-Ranges: bytes
Content-Type: text/html
Content-Language: en
for comparison purposes:
[gregames@gandalf gregames]$ runsocks nc httpd.apache.org 80
HEAD /docs/mod/core.html HTTP/1.0
host: httpd.apache.org
HTTP/1.1 200 OK
Date: Tue, 22 Jan 2002 19:49:07 GMT
Server: Apache/2.0.29 (Unix)
Content-Location: core.html.en
Vary: negotiate,accept-language
TCN: choice
Accept-Ranges: bytes
Connection: close
Content-Type: text/html
Content-Language: en
Expires: Tue, 22 Jan 2002 19:49:07 GMT
...so Andrzej's squid must be using HTTP/1.0
Greg
RE: Expires: header prevents caching
Posted by Joshua Slive <jo...@slive.ca>.
> From: gregames@Mail.MeepZor.Com [mailto:gregames@Mail.MeepZor.Com]On
> Behalf Of Greg Ames
> OK, I see what's happening:
>
> [gregames@daedalus apache]$ ls /www/httpd.apache.org/docs/mod/core*
> /www/httpd.apache.org/docs/mod/core.html.en
> /www/httpd.apache.org/docs/mod/core.html.fr
> /www/httpd.apache.org/docs/mod/core.html.html
>
> mod_negotiation is turning off caching because there are multiple
> versions of
> that document. We wouldn't want squid to cache an English version of the
> document and serve it to a French client.
I'm no protcol expert, but that doesn't make sense to me. mod_negotiation
should be adding "Accept-Language" to the Vary: header (yep, it's doing
that), but it shouldn't be setting Expires, should it? Proxies should be
free to cache the page, conditional on the Accept-Language.
Joshua.
Re: Expires: header prevents caching
Posted by Brian Behlendorf <br...@collab.net>.
On Tue, 22 Jan 2002, Greg Ames wrote:
> Greg Ames wrote:
> >
> > I tested the URL that Andrzej mentions below. Sho 'nuf, the value of the
> > Expires: headers we send is exactly the same as the value of the Date: header.
> > RFC 2616 says the content can't be cached by proxies in this case.
>
> OK, I see what's happening:
>
> [gregames@daedalus apache]$ ls /www/httpd.apache.org/docs/mod/core*
> /www/httpd.apache.org/docs/mod/core.html.en
> /www/httpd.apache.org/docs/mod/core.html.fr
> /www/httpd.apache.org/docs/mod/core.html.html
>
> mod_negotiation is turning off caching because there are multiple versions of
> that document. We wouldn't want squid to cache an English version of the
> document and serve it to a French client.
And the Vary: header is there and correct. Cool. I wonder how many
proxies grok Vary correctly.
Brian
Re: Expires: header prevents caching
Posted by Greg Ames <gr...@remulak.net>.
Greg Ames wrote:
>
> I tested the URL that Andrzej mentions below. Sho 'nuf, the value of the
> Expires: headers we send is exactly the same as the value of the Date: header.
> RFC 2616 says the content can't be cached by proxies in this case.
OK, I see what's happening:
[gregames@daedalus apache]$ ls /www/httpd.apache.org/docs/mod/core*
/www/httpd.apache.org/docs/mod/core.html.en
/www/httpd.apache.org/docs/mod/core.html.fr
/www/httpd.apache.org/docs/mod/core.html.html
mod_negotiation is turning off caching because there are multiple versions of
that document. We wouldn't want squid to cache an English version of the
document and serve it to a French client.
Greg
> ---------- Forwarded message ----------
> Date: Mon, 21 Jan 2002 12:55:17 +0100
> From: Andrzej Kukula <An...@navopgd.pl>
> To: webmaster@apache.org
> Subject: Two things
>
> Hello.
>
> 2. (Far more important) httpd.apache.org transmits the same Date: and
> Expires: HTTP headers, thus making squid unable to cache your pages. I've
> tested it with httpd.apache.org/docs/mod/core.html.
>
> Regards,
> Andrzej Kuku³a
Re: Expires: header prevents caching
Posted by Ian Holsman <ia...@apache.org>.
Greg Ames wrote:
> I tested the URL that Andrzej mentions below. Sho 'nuf, the value of the
> Expires: headers we send is exactly the same as the value of the Date: header.
> RFC 2616 says the content can't be cached by proxies in this case.
mod-include (which core.html runs through)
removes the 'Last-Modified'/Etag and I think, Expires headers
from the page. this is due to it not being able to set these properly.
(imaging a dynamic piece of content included at the very end of a file,
after the headers have been sent out)
does the main webserver use mod-expire?
>
> [gregames@gandalf gregames]$ runsocks nc httpd.apache.org 80
> HEAD /docs/mod/core.html HTTP/1.0
> host: httpd.apache.org
>
> HTTP/1.1 200 OK
> Date: Tue, 22 Jan 2002 15:34:16 GMT
> Server: Apache/2.0.29 (Unix)
> Content-Location: core.html.en
> Vary: negotiate,accept-language
> TCN: choice
> Accept-Ranges: bytes
> Connection: close
> Content-Type: text/html
> Content-Language: en
> Expires: Tue, 22 Jan 2002 15:34:16 GMT
>
> but for many other URLs, we don't bother with the Expires: header
>
> [gregames@gandalf gregames]$ runsocks nc httpd.apache.org 80
> HEAD /index.html HTTP/1.0
> host: httpd.apache.org
>
> HTTP/1.1 200 OK
> Date: Tue, 22 Jan 2002 15:44:37 GMT
> Server: Apache/2.0.29 (Unix)
> Accept-Ranges: bytes
> Content-Length: 6139
> Connection: close
> Content-Type: text/html
>
> Does anyone understand the care and feeding of Expires: headers in Apache?
> Seems like it would be in our best interest to allow caching for most/all static
> pages.
>
> Thanks,
> Greg
> -------- Original Message --------
> Subject: Two things (fwd)
> Date: Mon, 21 Jan 2002 09:39:05 -0800 (PST)
> From: Brian Behlendorf <br...@collab.net>
> To: trawick@apache.org, <gr...@apache.org>
>
>
> Notice the 2nd issue.
>
> Brian
>
> ---------- Forwarded message ----------
> Date: Mon, 21 Jan 2002 12:55:17 +0100
> From: Andrzej Kukula <An...@navopgd.pl>
> To: webmaster@apache.org
> Subject: Two things
>
>
> Hello.
>
> I've got just two annoying things:
>
> 1. On www.apache.org, httpd.apache.org there's no mention on a general
> contact concerning the Web Page, so I'm sending this message to well-known
> address.
>
> 2. (Far more important) httpd.apache.org transmits the same Date: and
> Expires: HTTP headers, thus making squid unable to cache your pages. I've
> tested it with httpd.apache.org/docs/mod/core.html.
>
> Regards,
> Andrzej Kuku?
>
>