1 / 10

CS193H: High Performance Web Sites Lecture 7: Add an Expires Header

CS193H: High Performance Web Sites Lecture 7: Add an Expires Header. Steve Souders Google souders@cs.stanford.edu. Announcements. No more hardcopy handouts – view/annotate online. Expires header. Expiration date determines freshness . Can also use Cache-Control: max-age.

rupert
Download Presentation

CS193H: High Performance Web Sites Lecture 7: Add an Expires Header

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS193H:High Performance Web SitesLecture 7: Add an Expires Header Steve Souders Google souders@cs.stanford.edu

  2. Announcements No more hardcopy handouts – view/annotate online

  3. Expires header Expiration date determines freshness. Can also use Cache-Control: max-age GET /v-app/scripts/107652916-dom.common.js HTTP/1.1 Host: www.blogger.com User-Agent: Mozilla/5.0 (…) Gecko/2008070208 Firefox/3.0.1 Accept-Encoding: gzip,deflate HTTP/1.1 200 OK Content-Type: application/x-javascript Last-Modified: Mon, 22 Sep 2008 21:14:35 GMT Content-Length: 2066 Content-Encoding: gzip Expires: Mon, 12 Oct 2009 14:57:34 GMT Cache-Control: max-age=31536000 XmoÛHþ\ÿFÖvã*wØoq...

  4. Expires vs. max-age Expires works in HTTP/1.0, max-age in HTTP/1.1 Expires is an absolute date: 12 Oct 2009 14:57:34 GMT max-age is # of seconds until expiration: 31536000 Expires relies on clock synchronization between client and server for short expirations max-age takes precedence over Expires

  5. Sending Expires (Apache) mod_expires <FilesMatch "\.(gif|jpg|js|css)$"> ExpiresDefault "access plus 1 year" </FilesMatch> sends both Expires and max-age: Expires: Mon, 12 Oct 2009 14:57:34 GMT Cache-Control: max-age=315360000

  6. Expires in the Wild – 2007 March 2007

  7. Expires in the Wild – 2008 October 2008

  8. Revving Filenames really, this is independent of Expires headers once you make a resource public, you can never change it => aggressive proxies prevent 100% of users from getting the update best solution: change the filename date: trough_062308.gif version #: onload_1.6.1.js checksum: 1076572916-dom.common.js don't use querystring: wikibits.js?179 won't be cached by some proxies

  9. Homework "Improving Top Site" class project: first set of improvements due by 23:59 Mon 10/22 THIS WILL AFFECT YOUR GRADE includes improvements from Rules 1-4 measure improvements using Hammerhead record results in your personal Web 100 sheet include URLs that I can check (in your sheet) read Chapter 4 of HPWS for 10/15

  10. Questions What's are some differences between Expires and max-age? What types of resources should an Expires header be used with? Once a resource is cached with a far future expiration date, how can you push updates and ensure users get the new version?

More Related