Ideal HTTP cache control headers for different types of resources

I would probably use these settings:

  1. Cache-Control: max-age=31556926 – Representations may be cached by any cache. The cached representation is to be considered fresh for 1 year:

    To mark a response as “never expires,” an origin server sends an
    Expires date approximately one year from the time the response is
    sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one
    year in the future.

  2. Cache-Control: no-cache – Representations are allowed to be cached by any cache. But caches must submit the request to the origin server for validation before releasing a cached copy.
  3. Cache-Control: no-store – Caches must not cache the representation under any condition.

See Mark Nottingham’s Caching Tutorial for further information.

Leave a Comment