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

Demystifying HTTP Headers for a Better Web @ SpaceCityJS

Demystifying HTTP Headers for a Better Web @ SpaceCityJS

Ever wonder exactly what combination of Cache-Control, Last-Modified, Expires, ETag, Vary, and Pragma headers will keep your content cached by browsers just long enough? And what exactly is a HTTP 304 anyway? In this talk, you’ll learn the history behind the available HTTP caching headers, what their values mean, and how browsers and proxies react. You’ll learn the best practices on client cache invalidation, the benefits of sending a Not Modified response, and briefly talk about the changes in HTTP 2.0 (SPDY) around caching — and then you’ll put your new-found header skills to the test!

Andrew Dunkman

March 28, 2015
Tweet

More Decks by Andrew Dunkman

Other Decks in Technology

Transcript

  1. Demystifying HTTP Headers
    for a Better Web
    Andrew: @adunkman

    View full-size slide

  2. http caching

    View full-size slide

  3. shared caches

    View full-size slide

  4. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  5. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  6. Wed, 14 May 2014 22:36:20 GMT

    View full-size slide

  7. Vary: User-Agent

    View full-size slide

  8. Vary: Accept-Encoding

    View full-size slide

  9. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  10. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  11. no-cache
    no-store
    no-transform
    max-age
    s-maxage
    must-revalidate
    proxy-revalidate
    max-stale
    public
    private

    View full-size slide

  12. max-age
    must-revalidate
    private
    public

    View full-size slide

  13. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  14. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  15. Last-Modified
    If-Modified-Since

    View full-size slide

  16. Etag
    If-None-Match

    View full-size slide

  17. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  18. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  19. Link: ; rel=prefetch

    View full-size slide

  20. Link: ; rel=subresource

    View full-size slide

  21. X-Associated-Content:
    "full-url":

    View full-size slide

  22. Expires, Vary
    Cache-Control
    Conditional Requests
    The Future of Caching

    View full-size slide

  23. mnot.net/cache_docs
    adunkman/http-cache-demo

    View full-size slide

  24. Thank you!
    Andrew: @adunkman

    View full-size slide