Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTTP Caching Basics

HTTP Caching Basics

Talk given at OpenCode Québec on December 18th, 2012. Supporting code is here: http://github.com/rafBM/opencode-httpcaching

Rafaël Blais Masson

December 18, 2012
Tweet

More Decks by Rafaël Blais Masson

Other Decks in Programming

Transcript

  1. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 <!DOCTYPE html> <html> <head> ...
  2. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 <!DOCTYPE html> <html> <head> ...
  3. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html Accept-Encoding: gzip HTTP/1.1

    200 OK Content-Type: text/html Content-Length: 1670 Content-Encoding: gzip ?W?o?6???7???-???^??tK?|h?m?T ID?????7???????9?fS,?h~xs?,??:V?2`v_??0њ?3G?A?x ...
  4. GET /flaberbeezle.twizz HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 404 Not

    Found Content-Type: text/html Content-Length: 2475 <!DOCTYPE html> <html> <head> ...
  5. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 301 Moved

    Permanently Location: http://www.heeeeeeeey.com/index.html
  6. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 <!DOCTYPE html> <html> ...
  7. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 <!DOCTYPE html> <html> ...
  8. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 Last-Modified: Tue, 18 Dec 2012 12:53:00 GMT <!DOCTYPE html> <html> ...
  9. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html If-Modified-Since: Tue, 18

    Dec 2012 12:53:00 GMT HTTP/1.1 200 OK Content-Type: text/html Content-Length: 3513 Last-Modified: Tue, 19 Dec 2012 14:25:00 GMT <!DOCTYPE html> <html> ...
  10. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 <!DOCTYPE html> <html> ...
  11. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 ETag: 165d96c6baae07f807115f00ca878431 <!DOCTYPE html> <html> ...
  12. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html If-None-Match: 165d96c6baae07f807115f00ca878431 HTTP/1.1

    200 OK Content-Type: text/html Content-Length: 3513 ETag: e075d8ff00c11543a876a96c8a07116b <!DOCTYPE html> <html> ...
  13. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 <!DOCTYPE html> <html> ...
  14. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 Cache-Control: max-age=3600 <!DOCTYPE html> <html> ...
  15. GET /index.html HTTP/1.1 Host: heeeeeeeey.com Accept: text/html HTTP/1.1 200 OK

    Content-Type: text/html Content-Length: 3513 Cache-Control: max-age=3600 <!DOCTYPE html> <html> ...