Skip to content

Commit

Permalink
Caching note - sending both ETag and If-Modified .. (mdn#26108)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
2 people authored and Mehrm0 committed Apr 14, 2023
1 parent e139229 commit 73786e0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions files/en-us/web/http/caching/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ The server will return `304 Not Modified` if the value of the `ETag` header it d

But if the server determines the requested resource should now have a different `ETag` value, the server will instead respond with a `200 OK` and the latest version of the resource.

> **Note:** When evaluating how to use `ETag` and `Last-Modified`, consider the following:
> During cache revalidation, if both `ETag` and `Last-Modified` are present, `ETag` takes precedence.
> Therefore, if you are only considering caching, you may think that `Last-Modified` is unnecessary.
> However, `Last-Modified` is not just useful for caching; instead, 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 preferable to provide both `ETag` and `Last-Modified`.
> **Note:** RFC9110 prefers that servers send both `ETag` and `Last-Modified` for a `200` response if possible.
> 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`.
### Force Revalidation

Expand Down

0 comments on commit 73786e0

Please sign in to comment.