Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: header & stale-while-revalidate #913

Open
jeffposnick opened this issue Jun 24, 2019 · 8 comments
Open

Warning: header & stale-while-revalidate #913

jeffposnick opened this issue Jun 24, 2019 · 8 comments
Labels
impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation topic: http

Comments

@jeffposnick
Copy link

While investigating the history behind the stale-while-revalidate Cache-Control option, I found that the original description in RFC5861 included the following:

If a cached response is served stale due to the presence of this extension, the cache SHOULD attempt to revalidate it while still serving stale responses (i.e., without blocking).

Note that "stale" implies that the response will have a non-zero Age header and a warning header, as per HTTP's requirements.

(I am not familiar with the story behind that RFC, but what I've gathered from talking informally to some folks is that it might have been geared more towards caching proxy providers and less towards the browser user agent use case.)

I believe that the warning header referred to there is the same thing as what's documented on MDN, and might look something along the lines of Warning: 110 <warn-agent> Response is Stale [<warn-date>]

The Fetch Standard now includes a section about stale-while-revalidate responses, but there's no mention of the Warning: header in that text. Chrome and Firefox both have implemented stale-while-revalidate, and in their implementations, there's no Warning: header present on the Response object when a stale response is used.

(https://glitch.com/edit/#!/s-w-r-demo is a really basic web app + server I put together to try this out.)

As a developer, I'd find information that would theoretically be present in a Warning: header to be useful, and I am curious whether its omission from the Fetch Standard was intentional or not. If it was intentional, and if RFC5861 is still relevant, then perhaps it should be marked as a willful violation?

@wanderview
Copy link
Member

It seems there was at least some kind of problem with the warning header:

https://tools.ietf.org/html/draft-ietf-http-warning-00

Is it one of those things that was never actually implemented in practice?

@mnot
Copy link
Member

mnot commented Jun 24, 2019

It is; we downgraded it to a SHOULD in RFC7234, and are removing it in the next revision of HTTP. See httpwg/http-core#139

@mnot
Copy link
Member

mnot commented Jun 24, 2019

BTW, if browser caches generated Age correctly, you could see for yourself if it was stale or not. See: https://cache-tests.fyi/?id=other-age-gen&id=other-age-update-expires&id=other-age-update-max-age#

@annevk
Copy link
Member

annevk commented Jun 27, 2019

@whatwg/documentation given the upcoming changes to HTTP let's remove this from MDN or at least make it clear it's about to be obsolete?

@annevk annevk added the impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation label Jun 27, 2019
@chrisdavidmills
Copy link

@annevk I added a note at the top of https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning to cover this; does this read OK?

Also, the compat-data for Warning says that it is supported everywhere, but this thread and httpwg/http-core#139 make me think that is not entirely accurate. I wonder if I need to at least add a clarifying note in the data to. clarify how useful it actually is?

@annevk
Copy link
Member

annevk commented Jun 27, 2019

If you have the equivalent of "blame" it'd be interesting to know why the person adding that data thought supported everywhere was applicable here.

@chrisdavidmills
Copy link

@annevk yeah, I'm not sure who did that. What do you think I should say in the compat-data.

@annevk
Copy link
Member

annevk commented Jul 3, 2019

I'm not sure and it might be a more general problem, as browsers don't support https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Charset either. Accept-Charset is only supported in the sense of not being able to set it from fetch() and the browser not doing anything funny if it appears in a response. So again, it really comes down to the criteria of what makes a supported HTTP header. I suppose I'd say "no" for both and only use "yes" if there's some processing model in place that is also supported as is the case for Cache-Control for instance (with caveats, as documented on that page).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation topic: http
Development

No branches or pull requests

5 participants