Re: dont-revalidate Cache-Control header

Ben Maurer <ben.maurer@gmail.com> Thu, 16 July 2015 15:36 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 66AC51A8893 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 16 Jul 2015 08:36:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.011
X-Spam-Level:
X-Spam-Status: No, score=-7.011 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9LZqDBwIDJMg for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 16 Jul 2015 08:36:18 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 520711A87AB for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 16 Jul 2015 08:36:17 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1ZFl9q-0005XC-Pa for ietf-http-wg-dist@listhub.w3.org; Thu, 16 Jul 2015 15:33:10 +0000
Resent-Date: Thu, 16 Jul 2015 15:33:10 +0000
Resent-Message-Id: <E1ZFl9q-0005XC-Pa@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <ben.maurer@gmail.com>) id 1ZFl9m-0005WQ-9G for ietf-http-wg@listhub.w3.org; Thu, 16 Jul 2015 15:33:06 +0000
Received: from mail-la0-f53.google.com ([209.85.215.53]) by lisa.w3.org with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.80) (envelope-from <ben.maurer@gmail.com>) id 1ZFl9g-0003Oy-Dt for ietf-http-wg@w3.org; Thu, 16 Jul 2015 15:33:05 +0000
Received: by lahh5 with SMTP id h5so45721205lah.2 for <ietf-http-wg@w3.org>; Thu, 16 Jul 2015 08:32:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zhBCmbtuFDfNBs40Qt/ZfO3QHohq16w/s5oQAJISRGs=; b=nJIXUT1hJmqVxP7tN1Y8FcjgCtuavrPrRZQL2DnAtzEI5DWGIH1+8Bjjb5uk0f4//n d7riR7WCPZ8oHKCIzhM5PalRKsmCE5m6EBrDZiMAqXQq0wHhnQ5U7p9Ckk1YxIWhPWQB Nr7aGeMBWTaVqIuywStzxDPMd87OCmREU5uDPEHMDGgaSxKk6Xljn6X7lnQaLGRHpy5u ZHpoBZbNCzG9+b6gbz/e/e5TacEGapg9X70Be+lVtbjJETSKvsrJCdiTD3wCtHZjg1mj wOI0nvx7pEDiZXxZeLgSyLCgOGzyw5rEH4UvnyhWEEW9MiGa7utok9K4LxEif5KImpsO SA9A==
MIME-Version: 1.0
X-Received: by 10.152.181.34 with SMTP id dt2mr9858979lac.84.1437060753686; Thu, 16 Jul 2015 08:32:33 -0700 (PDT)
Received: by 10.25.163.147 with HTTP; Thu, 16 Jul 2015 08:32:33 -0700 (PDT)
In-Reply-To: <55A7A4F9.1010500@treenet.co.nz>
References: <CABgOVaLHBb4zcgvO4NUUmAzUjNkocBGYY3atFA9iuYyoLaLQsA@mail.gmail.com> <559F9E90.4020801@treenet.co.nz> <CABgOVaLG6QZyjqk2AGYupShST_u3ty9BpxUcPX+_yMEC1hyHAQ@mail.gmail.com> <961203FE-7E54-410F-923E-71C04914CD2E@mnot.net> <CABgOVaJxntEyT0v4GvWm0Qi9jbUPEnzxJgg4KyQSM1T_gN1mjQ@mail.gmail.com> <16407353-5C34-42E8-81A6-E0027EC3A0D0@mnot.net> <CABgOVa+C48yYp-ZkawY+Ho6pXONa_UfB0MVt_2+d0ejyESu2Pw@mail.gmail.com> <54973543-2406-4188-8DCD-AE3C85ACB76A@mnot.net> <CABgOVa+CrJ0qBGN-nBYZ2qpJo8X+wkYY-zYAqM6MjTom1QT+Bw@mail.gmail.com> <55A7A4F9.1010500@treenet.co.nz>
Date: Thu, 16 Jul 2015 16:32:33 +0100
Message-ID: <CABgOVaLnpnmd7JvY6O=tXXboVuvCCn-p1KLzu8wKVkg-yon79w@mail.gmail.com>
From: Ben Maurer <ben.maurer@gmail.com>
To: Amos Jeffries <squid3@treenet.co.nz>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="001a11341b46be8a8c051affc791"
Received-SPF: pass client-ip=209.85.215.53; envelope-from=ben.maurer@gmail.com; helo=mail-la0-f53.google.com
X-W3C-Hub-Spam-Status: No, score=-5.6
X-W3C-Hub-Spam-Report: AWL=-0.856, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: lisa.w3.org 1ZFl9g-0003Oy-Dt 2c0eb8dea17a2a29bdbe82f9ca8ee1c1
X-Original-To: ietf-http-wg@w3.org
Subject: Re: dont-revalidate Cache-Control header
Archived-At: <http://www.w3.org/mid/CABgOVaLnpnmd7JvY6O=tXXboVuvCCn-p1KLzu8wKVkg-yon79w@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/29973
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Thanks for the feedback!

On Thu, Jul 16, 2015 at 1:35 PM, Amos Jeffries <squid3@treenet.co.nz> wrote:

> > changes then giving each such URI an extremely distant expiration date.
> >
> > The static HTTP Cache-Control extension clarifies that a resource is
> > guaranteed never to change and allows caches to optimize based on these
> > semantics. For example, it allows user agents to avoid revalidating
> static
> > resources when a user presses the reload button. It also signals to
> caches
> > that the expiration date of the object may be set further in the future
> > than the actual expected lifetime of the object.
>
> I dont think that last statement is correct. "may be set" implies that
> heuristic lifetimes are applicable. But this control is explicitly
> setting maximum lifetime when Expires/max-age/s-maxage are absent. That
> is not a heuristic estimation but the absolute "infinity" value for the
> cache.


What I was trying to say here is that if I have a resource foo-v1.js with a
lifetime of 1 year, I'm not actually expecting the resource to be useful
for 1 year, merely that the value of the resource won't change. "static"
might help signal this and change cache ranking algorithms.

That said, this was a side note, and I don't know of anybody who uses
expiration dates in this way, and could probably be deleted.



> >
> > 2. The static Cache-Control extension
> >
> > When present in an HTTP response, the static Cache-Control extension
> > indicates that the semantic content of the response will never change in
> > the future. A server MUST NOT either in the past or future serve
> different
> > semantic content for the same URI. If a server accidentally serves
> > different content on the URI, it MUST alter all resources that reference
> > that URI to reference a different URI. A server MAY either in the past or
> > future serve an error response for the URI. The static cache-control
> header
> > MUST be used with either the "public" or "private" cache-control
> directive.
>
> Why? content is always either public or private no matter what
> Cache-Controls are used.


Yeah, this may be better removed.


>
> > It MUST NOT be used in combination with "no-cache", "no-store", or
> > "must-revalidate".
>
> Or proxy-revalidate, or stale-while-revalidate, ... and the as yet
> undefined ones?
>
> Also, what if it does happen? Effectively any combination of cache
> controls can be sent.
>
> IMHO its probably best to say that when this control is present in
> responses any other controls causing revalidation MUST NOT be generated
> by senders, and recipients must ignore such revalidation controls. With
> the list of named controls just an example set.
>

Personally, I'd prefer to have static overridden by by other headers --
better to be more conservative and and make the browser refresh more.



>
>
> > The server MUST send a max-age directive and SHOULD use
> > a delta-age of at least 30 days.
>
> Why the MUST? "static" by itself could mean caching for maximum lifetime
> permitted. (ie ~68 years).
>
> The SHOULD and delta-age seems arbitrary. I thought the intent of
> "static" was to prevent heuristic cache expiry/revalidation limits being
> applied anyways.
>

I guess it doesn't need to be a must, but it seems like a poor decision for
one to have a short lifetime that would apply to UAs that did not implement
this extension. Maybe it should be "SHOULD specify a long max-age (eg, 30
days or more) for the sake of caches that have not implemented this
extension".



>
> >
> > A cache MUST treat a response with the static Cache-Control extension as
> > having the maximum allowable lifetime for that cache.
>
> There you go. :-) the max-age bit conflicts here.


The idea is that static should take precedence over max-age. You need to
support max-age for legacy caches. I could have been more clear here.




> > The cache SHOULD NOT
> > attempt to revalidate the response.
>
> s/SHOULD NOT/MUST NOT/ and this one line encompasses almost all the
> requirements about revalidation controls.
>

I debated about making this MUST NOT. Using MUST NOT would conflict with
any type of heuristics (in the security considerations section)

 s/by the refreshing/ by reloading/
>
> > extension when a URI is directly navigated to by a user rather than
> > referenced by another page.
>
> Lots of MUST criteria, then a giant loophole of MAY ignore it all is a
> bit rough. All the non-browser agents including middleware/shared caches
> either cannot identify a "directly navigated" URL (or consider
> *everything* as directly navigated) anyways so the MAY is just setting
> up a worse problem of conflicting cache behaviour between software.
>
> Probably best to leave the client sent Cache-Control:max-age=0 (aka
> force-reload) control operational as a non-conditional fetch. This is
> already implied by the text at the end of section 2.
>

You're right that I hadn't been thinking about this with the perspective of
browser with an intermediate cache. I guess the behavior I'm suggesting
here is that a browser should treat a refresh on the main resource the same
as it does today (send a max-age=0 request), however it should *not* do
this for sub-resources that have the static extension. Open to other
suggestions about behavior here -- mainly I want to provide a safety net if
a hack/mistake were to make www.foo.com/ return a corrupt document with a
static caching flag.