Issue link: https://read.uberflip.com/i/1146286
90 | Chapter 13: Rule 13: Configure ETags Conditional GET Requests In the event a cached component does expire (or the user explicitly reloads the page), the browser can't reuse it without first checking that it is still valid. This is called a conditional GET request (see the section "Conditional GET Requests" in Chapter B). It's unfortunate that the browser has to make this HTTP request to perform a valid- ity check, but it's more efficient than simply downloading every component that has expired. If the component in the browser's cache is valid (i.e., it matches what's on the origin server), instead of returning the entire component, the origin server returns a "304 Not Modified" status code. There are two ways in which the server determines whether the cached component matches the one on the origin server: • By comparing the last-modified date • By comparing the entity tag Last-Modified Date The component's last-modified date is returned by the origin server via the Last- Modified response header. GET /i/yahoo.gif HTTP/1.1 Host: us.yimg.com HTTP/1.1 200 OK Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT Content-Length: 1195 In this example, the browser caches the component (in this case, the Yahoo! logo) along with its last-modified date. The next time http://us.yimg.com/i/yahoo.gif is requested, the browser uses the If-Modified-Since header to pass the last-modified date back to the origin server for comparison. If the last-modified date on the origin server matches that sent by the browser, a 304 response is returned and the 1195 bytes of data don't have to be sent. GET /i/yahoo.gif HTTP/1.1 Host: us.yimg.com If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT HTTP/1.1 304 Not Modified

