-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
Caching note - sending both ETag and If-Modified .. #26108
Conversation
> During cache revalidation, if both `If-Modified-Since` and `If-None-Match` are present, then `If-None-Match` takes precedence for the validator. | ||
> If you are only considering caching, you may think that `Last-Modified` is unnecessary. | ||
> However, `Last-Modified` is not just useful for caching; it is a standard HTTP header that is also used by content-management (CMS) systems to display the last-modified time, by crawlers to adjust crawl frequency, and for other various purposes. | ||
> So considering the overall HTTP ecosystem, it is better to provide both `ETag` and `Last-Modified`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just rearranges the original suggestion by Jxck (below is a subedited version of that)
Note: When evaluating how to use
ETag
andLast-Modified
, consider the following:
during cache revalidation, if bothIf-Modified-Since
andIf-None-Match
are present, thenIf-None-Match
takes precedence for the validator.
If you are only considering caching, you may think thatLast-Modified
is unnecessary.
However,Last-Modified
is not just useful for caching; it is a standard HTTP header that is also used by content-management (CMS) systems to display the last-modified time, by crawlers to adjust crawl frequency, and for other various purposes.
So considering the overall HTTP ecosystem, it is better to provide bothETag
andLast-Modified
.
This is why RFC9110 prefers that server should send bothETag
andLast-Modified
for a200
response if possible.
Preview URLs (comment last updated: 2023-04-14 01:28:29) |
LGTM, thanks ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One sentence sounded strange, but else it is 👍
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
Thanks. Accepted your change @teoli2003 - ready for re-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* Caching note - sending both ETag and If-Modified .. * Update files/en-us/web/http/caching/index.md Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com> --------- Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
In the process of discussing retrospectives, a "fresh" PR (Pull Request) is also included as one of the changes. |
Fixes #26064 using a slightly modified form of the comment provided by @Jxck .
The difference is that the note starts with direction for the user "send both headers", and then explains why. Generally this is a better way to write because people scanning the material get the point first.