{"id":173,"date":"2008-03-28T05:17:00","date_gmt":"2008-03-28T05:17:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=173"},"modified":"2008-03-28T05:17:00","modified_gmt":"2008-03-28T05:17:00","slug":"cache-control-server-vs-client","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=173","title":{"rendered":"Cache Control &#8211; Server vs. Client"},"content":{"rendered":"<p>The server can set Cache-Control as far as it wants but if the client browser (Firefox, IE, etc.) says something else, the client rules. For example: an image with proper server&#8217;s Cache-control and Expires headers. If the client says &#8220;Cache-control: max-age=0&#8221; in its request, a conditional GET request will send and HTTP 304 code would return from the server. The expected and best behavior would be no request at all. <\/p>\n<p>It&#8217;s not the server&#8217;s fault, it&#8217;s done its part correctly. The client is now in control and it seems Firefox and IE on my machine don&#8217;t like caching that much. So 304&#8217;s instead of zero request for now.<\/p>\n<p>Update: Firefox actually is pretty smart on this. If you click F5, Refresh or a direct reload, it will send cache-control: max-age=0. It means the server will return 304&#8217;s. But if you move from one page to the next and the page reuse other cached component, Firefox won&#8217;t make any request at all, which is the expected behavior. Now I can sleep tight knowing that our pages are faster as fewer conditional GET requests are made.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The server can set Cache-Control as far as it wants but if the client browser (Firefox, IE, etc.) says something else, the client rules. For example: an image with proper server&#8217;s Cache-control and Expires headers. If the client says &#8220;Cache-control: max-age=0&#8221; in its request, a conditional GET request will send and HTTP 304 code would [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/173"}],"collection":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}