Re: dont-revalidate Cache-Control header

Ben Maurer <ben.maurer@gmail.com> Thu, 16 July 2015 11:04 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 A3A021B399D for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 16 Jul 2015 04:04:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.411
X-Spam-Level:
X-Spam-Status: No, score=-6.411 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, J_CHICKENPOX_66=0.6, 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 1K-0Uy8-w4O5 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 16 Jul 2015 04:04:39 -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 AD6291B399B for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 16 Jul 2015 04:04:39 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1ZFgup-0003IP-By for ietf-http-wg-dist@listhub.w3.org; Thu, 16 Jul 2015 11:01:23 +0000
Resent-Date: Thu, 16 Jul 2015 11:01:23 +0000
Resent-Message-Id: <E1ZFgup-0003IP-By@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 1ZFgul-0003Hi-Lg for ietf-http-wg@listhub.w3.org; Thu, 16 Jul 2015 11:01:19 +0000
Received: from mail-lb0-f174.google.com ([209.85.217.174]) by lisa.w3.org with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.80) (envelope-from <ben.maurer@gmail.com>) id 1ZFguj-0001pB-9E for ietf-http-wg@w3.org; Thu, 16 Jul 2015 11:01:19 +0000
Received: by lbbzr7 with SMTP id zr7so41427815lbb.1 for <ietf-http-wg@w3.org>; Thu, 16 Jul 2015 04:00:50 -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=1XLPwaAbKueyxqI3IaDpVGig9HQBAsgaAJEPXJc9c+A=; b=mXw9CeBMkTDJ2+hVAczdTVQNjf7mwpclfFYhKBQAYzTxYxwFxQnmslSEOFk/tyv2IW vnICjzxcSLD4iv/jqf6tJDQ2I7GHGWq8fKnS9n9HN1rh2rWnF8yO5TQeQbss7Hn/VMki XPcZ9kq1uxzjDT94T2X1RBt+ngxMAiolycOoBNlvVeYnItE7Gm+pm64M3FXaMZEeF42q s+BapLo79rcCvxrAc/GmyN5o3UF/YnM3N8yfV/KZkihfnoYcQaXYEcevhLIru7KM12RX pLPHvhR/9pKd/H01CtciXUblqReuuANrK1qnMg7/BmJ+kHh6ft98PglJ5nPw9XBA4dP5 FLgg==
MIME-Version: 1.0
X-Received: by 10.112.135.131 with SMTP id ps3mr8759736lbb.84.1437044450654; Thu, 16 Jul 2015 04:00:50 -0700 (PDT)
Received: by 10.25.163.147 with HTTP; Thu, 16 Jul 2015 04:00:50 -0700 (PDT)
In-Reply-To: <54973543-2406-4188-8DCD-AE3C85ACB76A@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> <16407353-5C34-42E8-81A6-E0027EC3A0D0@mnot.net> <CABgOVa+C48yYp-ZkawY+Ho6pXONa_UfB0MVt_2+d0ejyESu2Pw@mail.gmail.com> <54973543-2406-4188-8DCD-AE3C85ACB76A@mnot.net>
Date: Thu, 16 Jul 2015 12:00:50 +0100
Message-ID: <CABgOVa+CrJ0qBGN-nBYZ2qpJo8X+wkYY-zYAqM6MjTom1QT+Bw@mail.gmail.com>
From: Ben Maurer <ben.maurer@gmail.com>
To: Mark Nottingham <mnot@mnot.net>
Cc: Amos Jeffries <squid3@treenet.co.nz>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="089e0112c2700200ef051afbfc9b"
Received-SPF: pass client-ip=209.85.217.174; envelope-from=ben.maurer@gmail.com; helo=mail-lb0-f174.google.com
X-W3C-Hub-Spam-Status: No, score=-5.6
X-W3C-Hub-Spam-Report: AWL=-0.878, 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 1ZFguj-0001pB-9E 54a6df0382e9fdc7727029566a30b03a
X-Original-To: ietf-http-wg@w3.org
Subject: Re: dont-revalidate Cache-Control header
Archived-At: <http://www.w3.org/mid/CABgOVa+CrJ0qBGN-nBYZ2qpJo8X+wkYY-zYAqM6MjTom1QT+Bw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/29971
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>

Here's a sketch of what I think a spec might look like, modeled off the
stale-while-revalidate spec.

- I wasn't sure how specific we should get about the handling of browser
reload behavior.
- The static resource must stay "semantically" the same in this spec. This
allows for static resources that could change on a byte-by-byte basis --
for example if they are recompressed, etc.
- The main security risk I can think of here is defacement (there's also a
similar operational risk of accidentally returning a static document on the
root page of your domain). As I noted, I think a reasonable mitigation here
is to only apply the static semantics to sub-resources. Personally as a
site owner, I'd prefer that UAs always revalidate content that the user
directly navigates to.

Abstract

This document defines a Cache-Control extension formalizing of HTTP
resources with long expiration times where the URI of the resource is
changed when the content of the resource is changed.

1. Introduction

RFC7234 states "The goal of caching in HTTP/1.1 is to significantly improve
performance by reusing a prior response message to satisfy a current
request" Highly performant websites seek to maximize the efficiency of HTTP
caches by changing the URI of their resources every time the resource
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.

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.
It MUST NOT be used in combination with "no-cache", "no-store", or
"must-revalidate". The server MUST send a max-age directive and SHOULD use
a delta-age of at least 30 days.

A cache MUST treat a response with the static Cache-Control extension as
having the maximum allowable lifetime for that cache. The cache SHOULD NOT
attempt to revalidate the response. Operations that would normally cause
the cache to revalidate the resource SHOULD result in the reuse of the
cached response. The cache MAY make an unconditional request for the
resource in response for an end-to-end reload. A user agent SHOULD NOT
generate an end-to-end reload in response to prominent user-facing
functionality such as a reload button.

2.1 Example

A HTTP response might have the header:

Cache-Control: public,static,max-age=31536000

While normally this resource would only be considered cacheable for 1 year,
a cache may choose to store it for as long as it wished. If the page using
this resource was refreshed, the user agent would not revalidate the
response. If the server wishes to change the contents of the resource in a
semantically meaningful way, it would place the resource on new URI.

3.  Security Considerations

User agents already have the capability of caching resources for long
periods of time. The static header alters the behavior of the reload button
so that it no longer triggers revalidation. The static Cache-Control
extension is designed to be used for sub-resources where the user does not
see the URI of the request. If an attacker were to compromise a directly
used URI (say the root document of a domain) and serve a response with the
static extension, it could deface the URI in a way that would not easily be
reversed by the refreshing the page. User Agents MAY  ignore the static
extension when a URI is directly navigated to by a user rather than
referenced by another page.

On Thu, Jul 16, 2015 at 10:26 AM, Mark Nottingham <mnot@mnot.net> wrote:

>
> > On 14 Jul 2015, at 2:36 pm, Ben Maurer <ben.maurer@gmail.com> wrote:
> >
> > Static is a fairly reasonable name. Static does imply that the resource
> will *never* be revalidated (ever) vs the dont-reload which implies no
> revalidations prior to expiration. I don't have any preferences between the
> two but wanted to call that out.
> >
> > What's the next step here?
>
> Writing a small spec. Is there anyone who has experience doing this that's
> interested in helping out here? E.g., Ilya?
>
> Cheers,
>
> --
> Mark Nottingham   https://www.mnot.net/
>
>
>
>
>