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

Caching note - sending both ETag and If-Modified .. #26108

Merged
merged 2 commits into from
Apr 14, 2023

Conversation

hamishwillee
Copy link
Collaborator

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.

@hamishwillee hamishwillee requested a review from a team as a code owner April 11, 2023 07:19
@hamishwillee hamishwillee requested review from teoli2003 and removed request for a team April 11, 2023 07:19
@github-actions github-actions bot added the Content:HTTP HTTP docs label Apr 11, 2023
> 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`.

Copy link
Collaborator Author

@hamishwillee hamishwillee Apr 11, 2023

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 and Last-Modified, consider the following:
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.
This is why RFC9110 prefers that server should send both ETag and Last-Modified for a 200 response if possible.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 11, 2023

Preview URLs

(comment last updated: 2023-04-14 01:28:29)

@Jxck
Copy link
Contributor

Jxck commented Apr 11, 2023

LGTM, thanks !

Copy link
Contributor

@teoli2003 teoli2003 left a 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 👍

files/en-us/web/http/caching/index.md Outdated Show resolved Hide resolved
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
@hamishwillee hamishwillee requested a review from teoli2003 April 14, 2023 01:27
@hamishwillee
Copy link
Collaborator Author

Thanks. Accepted your change @teoli2003 - ready for re-review

Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@teoli2003 teoli2003 merged commit a18cfe0 into main Apr 14, 2023
@teoli2003 teoli2003 deleted the hamishwillee-patch-2 branch April 14, 2023 05:34
Mehrm0 pushed a commit to Mehrm0/content that referenced this pull request Apr 14, 2023
* 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>
@bigbigDreamer
Copy link

jshttp/fresh#38

In the process of discussing retrospectives, a "fresh" PR (Pull Request) is also included as one of the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTTP HTTP docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regarding cache priority, the content expression is not rigorous enough.
4 participants