dotnet / dotnet/aspnetcore

Support RFC 5861 Cache-Control Extensions

Open
#60,008 0 comments 3 reactions 0 assignees View on GitHub
area-middleware
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

[https://httpwg.org/specs/rfc5861.html](RFC 5861) extends the Cache-Control header to include two new directives for http responses, `stale-while-revalidate` and `stale-if-error`.

`stale-while-revalidate` in particular is supported by all main browsers, `stale-if-error` whilst doesn't appear to have browser support is in use by some cdns.

Currently to set either of these means having to manually play about with the Cache-Control header and/or implementing your own middleware.

### Describe the solution you'd like

It would be nice if either of these could be supported by the `ResponseCachingMiddleware` in order to signal clients how caching should be handled.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.