Re: dont-revalidate Cache-Control header

Mark Nottingham <mnot@mnot.net> Tue, 14 July 2015 12:06 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 6E1051AC3EC for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 14 Jul 2015 05:06:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.912
X-Spam-Level:
X-Spam-Status: No, score=-6.912 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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 vQBiEETJlyae for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 14 Jul 2015 05:05:59 -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 041AE1AC3E7 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 14 Jul 2015 05:05:54 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1ZEyuy-0003y5-5w for ietf-http-wg-dist@listhub.w3.org; Tue, 14 Jul 2015 12:02:36 +0000
Resent-Date: Tue, 14 Jul 2015 12:02:36 +0000
Resent-Message-Id: <E1ZEyuy-0003y5-5w@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <mnot@mnot.net>) id 1ZEyup-0003xK-Od for ietf-http-wg@listhub.w3.org; Tue, 14 Jul 2015 12:02:27 +0000
Received: from mxout-08.mxes.net ([216.86.168.183]) by maggie.w3.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from <mnot@mnot.net>) id 1ZEyun-0002yg-VP for ietf-http-wg@w3.org; Tue, 14 Jul 2015 12:02:27 +0000
Received: from [10.249.33.98] (unknown [178.19.212.228]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 3E953509C2; Tue, 14 Jul 2015 08:01:59 -0400 (EDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <CABgOVaJxntEyT0v4GvWm0Qi9jbUPEnzxJgg4KyQSM1T_gN1mjQ@mail.gmail.com>
Date: Tue, 14 Jul 2015 14:01:57 +0200
Cc: Amos Jeffries <squid3@treenet.co.nz>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <16407353-5C34-42E8-81A6-E0027EC3A0D0@mnot.net>
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>
To: Ben Maurer <ben.maurer@gmail.com>
X-Mailer: Apple Mail (2.2102)
Received-SPF: pass client-ip=216.86.168.183; envelope-from=mnot@mnot.net; helo=mxout-08.mxes.net
X-W3C-Hub-Spam-Status: No, score=-9.6
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_IRR=-3, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1ZEyun-0002yg-VP 3b9691de4766178ec2996826f703b9fa
X-Original-To: ietf-http-wg@w3.org
Subject: Re: dont-revalidate Cache-Control header
Archived-At: <http://www.w3.org/mid/16407353-5C34-42E8-81A6-E0027EC3A0D0@mnot.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/29953
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>

Hey Ben,

> On 12 Jul 2015, at 3:58 am, Ben Maurer <ben.maurer@gmail.com> wrote:
> 
> Hey Mark,
> 
> This suggestion also came up in prior discussions of the problem. One major issue with this solution is that it doesn't address situations where content is embedded in a third party site. Eg, if a user includes an API like Google Maps or the Facebook like button those APIs may load subresources that should fall under this stricter policy. This issue cuts both ways -- if 3rd party content on your site isn't prepared for these semantics you could break it.

Yes. That problem (and similar ones) is coming up in a number of contexts, so there are quite a few headers being minted at the moment :-/

Maybe a HTML control for first-party and near-party control, and a header for third-party? (just thinking out loud; not a big fan of duplication of effort in general, but it might be worthwhile here).


> I believe UAs were worried about the potential security implications of such an extension -- eg what if you could alter the caching semantics of a SWF that had privileged cross origin access so that you could extend the lifetime of a vulnerable version (granted this extension would only make the situation worse in the case where the user refreshed the page, so it might not be that big of a deal).

Sorry - you lost me at "secure" and "swf" :)


> A third design I had discussed would be a heuristic. For example:
> 
> If a UA would normally revalidate a fresh resource due to a user action expressing interest in requesting a fresh page (eg if the user presses the reload button) it SHOULD use the following heuristic to avoid excessive revalidations. If the difference between freshness_lifetime and current_age is less than 7 days, then the UA SHOULD NOT perform the revalidation and serve the resource.
> 
> The idea here is that reloading is such a rare action (2% of page views according to our stats) that no reasonable site would design their experience around the user using the reload button. On the other hand it might be reasonable for the site to have something with a 5 minute freshness lifetime and for the user to want an up-to-date version of the resource
> 
> Pros:
> - No changes to existing headers
> - Would provide a speedup for people who are currently following best practices
> 
> Cons:
> - Feels like magic
> - Theoretically changes the behavior of a site which actively encourages it's users to use the reload button (I've never seen such a site)
> - Forces a developer who actively edits their code to use short lifetimes or ctrl+shift+r
> - UAs are hesitant to do anything which changes existing behavior.
> 
> Do you have any more thoughts on preferences between these options?

I agree with your dislike of magic…

From time to time, we've had people ask for "Cache-Control: Infinity-I-really-will-never-change-this." I suspect that often they don't understand how caches work, and that assigning a one-year lifetime is more than adequate for this purpose, but nevertheless, we could define that so that it worked and gave you the semantics you want too.

To keep it backwards compatible, you'd need something like:

Cache-Control: max-age=31536000, static

(or whatever we call it)

Cheers,

> 
> On Fri, Jul 10, 2015 at 6:33 PM, Mark Nottingham <mnot@mnot.net> wrote:
> Hi Ben,
> 
> > On 11 Jul 2015, at 3:14 am, Ben Maurer <ben.maurer@gmail.com> wrote:
> >
> > 2) Create a new behavior that websites can opt in to. Ensure that UAs implement it consistently. This has less risk of breaking existing sites, though I understand the hesitance to have a header that says "no *REALLY* trust my expiration times". Perhaps the header is poorly advertising the functionality that we wish to achieve. A better name/behavior might be Cache-control: content-addressed. content-addressed would signal that the contents of the current URL is a pure function of the URL itself. IE, that the contents will never change. It would take priority over a max-age header and signal to the browser that the resource should be permanently cached.
> 
> This seems like the crux of the matter. A CC extension is one way to do this, but I wonder if a more appropriate place might be in HTML, since this is really about how the browser behaves in reaction to user input, not how the cache behaves.
> 
> Cheers,
> 
> 
> --
> Mark Nottingham   https://www.mnot.net/
> 
> 
> 
> 
> 

--
Mark Nottingham   https://www.mnot.net/