Thursday, August 02, 2018

2018-08-02 Thursday - Web Browser HTTP Caching

A former colleague asked me a few questions recently regarding the why of web browser caching, due to some perceived unexpected behavior in their SaaS solution offering - and I prepared this short list of resources for them to read.  This is a topic that is a bit more complex than what might appear at first glance - due to the caching that can occur on the browser, or on the server side, or via some intermediary - such as a Content Distribution Network, or an in-memory data caching layer (such as Redis, MongoDB, or MemcacheDB, or Cassandra)

"Here be dragons..."


HTTP caching occurs when the browser stores local copies of web resources for faster retrieval the next time the resource is required. As your application serves resources it can attach cache headers to the response specifying the desired cache behavior.

A good overview of caching
https://medium.com/@codebyamir/a-web-developers-guide-to-browser-caching-cc41f3b73e7c

https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
Caching is a technique that stores a copy of a given resource and serves it back when requested. When a web cache has a requested resource in its store, it intercepts the request and returns its copy instead of re-downloading from the originating server.

NOTE: See the discussion on "Freshness"
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
The Cache-Control general-header field is used to specify directives for caching mechanisms in both requests and responses. Caching directives are unidirectional, meaning that a given directive in a request is not implying that the same directive is to be given in the response.


A bit older article, but might be a good read too...
https://www.mnot.net/cache_docs/

some good technical articles - with good technical discussion
RFC-7234 Hypertext Transfer Protocol (HTTP/1.1): Caching
https://tools.ietf.org/html/rfc7234

RFC-2616, Section 14 Header Field Defintiions
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Some additional articles to read/review:

No comments:

Copyright

© 2001-2021 International Technology Ventures, Inc., All Rights Reserved.