Sitemap

Member-only story

http cache header

Nov 2, 2020

--

http cache header

to understand cache we need to understand three components

  1. Client(browser,app etc)
  2. Reverse proxy / Intermediate proxy server ( like nginx ,cloudfare etc)
  3. origin server ( actual backend server like nodejs etc)

cache-control : no-store

Dont store cached files in any where ( Cient as well as Reverse proxy)

cache-control : no-cache

Client and proxy can Cache. But before serving the request send GET if-modified-since header to origin and see whether the file is modified. If modified serve the latest. If not modified origin will return 304( content not modified)

cache-control : max-age=0s

This header will work same like no-cache , but it is for browser cache expiry

cache-control : s-max-age=0s

This header will work same like no-cache , but it is for reverseproxy/intermediate cache expiry

cache-control : must-revalidate

What if origin server gets down before the expiry time? To handle stale connections this header is used to make sure proxy always send data only if origin server is live

pragma: no-cache

similar to cache-control , but for http 1.1 version backward compatibility

--

--

No responses yet