Issue link: https://read.uberflip.com/i/1146286
Conditional GET Requests | 7 Compression The size of the response is reduced using compression if both the browser and server support it. Browsers announce their support of compression using the Accept- Encoding header. Servers identify compressed responses using the Content-Encoding header. GET /us.js.yimg.com/lib/common/utils/2/yahoo_2.0.0-b2.js HTTP/1.1 Host: us.js2.yimg.com User-Agent: Mozilla/5.0 (...) Gecko/20061206 Firefox/1.5.0.9 Accept-Encoding: gzip,deflate HTTP/1.1 200 OK Content-Type: application/x-javascript Last-Modified: Wed, 22 Feb 2006 04:15:54 GMT Content-Length: 255 Content-Encoding: gzip ^_\213^H^@^@^@^@^@^@^Cl\217\315j\3030^P\204_E\361IJ... Notice how the body of the response is compressed. Chapter 4 explains how to turn on compression, and warns about edge cases that can arise due to proxy caching. The Vary and Cache-Control headers are also discussed. Conditional GET Requests If the browser has a copy of the component in its cache, but isn't sure whether it's still valid, a conditional GET request is made. If the cached copy is still valid, the browser uses the copy from its cache, resulting in a smaller response and a faster user experience. Typically, the validity of the cached copy is derived from the date it was last modi- fied. The browser knows when the component was last modified based on the Last- Modified header in the response (refer to the previous sample responses). It uses the If-Modified-Since header to send the last modified date back to the server. The browser is essentially saying, "I have a version of this resource with the following last modified date. May I just use it?" GET /us.js.yimg.com/lib/common/utils/2/yahoo_2.0.0-b2.js HTTP/1.1 Host: us.js2.yimg.com User-Agent: Mozilla/5.0 (...) Gecko/20061206 Firefox/1.5.0.9 Accept-Encoding: gzip,deflate If-Modified-Since: Wed, 22 Feb 2006 04:15:54 GMT HTTP/1.1 304 Not Modified Content-Type: application/x-javascript Last-Modified: Wed, 22 Feb 2006 04:15:54 GMT

