{"id":6788,"date":"2018-11-01T02:58:09","date_gmt":"2018-11-01T06:58:09","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=6788"},"modified":"2021-12-08T11:23:34","modified_gmt":"2021-12-08T16:23:34","slug":"cache-control-http-headers-html-explained","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/","title":{"rendered":"How to set HTTP Headers for Cache-Control"},"content":{"rendered":"\n

Web developers are always finding new ways to speed up the experience for website visitors. There is one not-so-new way to add to the performance that is not quite used to its extent and that’s the Cache-control.<\/p>\n\n\n\n

The cache can be controlled from the server-side, from the DNS, reverse proxies, and more. However, today we will be looking at how to do this using the HTTP<\/a> headers for cache control using HTML<\/a>.<\/p>\n\n\n\n

Pragma, the HTTP\/1.0 Implementation<\/h2>\n\n\n\n

The throwback to the days of HTTP\/1.0 that was used was the Pragma directive. Though it is no longer recommended, I have included it here for nostalgic purposes.<\/p>\n\n\n\n

<meta http-equiv="pragma" content="no-cache"><\/code><\/pre>\n\n\n\n

If that is no longer recommended and even fails on various HTML validators, what is the correct way to do this?<\/p>\n\n\n\n

Cache-Control, the HTTP\/1.1 Implementation<\/h2>\n\n\n\n

With HTML5 and HTTP\/1.1, it is recommended that one used the cache-control implementations. With just a couple of changes, you are on your way to properly getting web browsers to cache your web<\/a> pages.<\/p>\n\n\n\n

This is the HTTP\/1.1 implementation with cache-control.<\/p>\n\n\n\n

<meta http-equiv="Cache-control" content="public">\n<meta http-equiv="Cache-control" content="private">\n<meta http-equiv="Cache-control" content="no-cache">\n<meta http-equiv="Cache-control" content="no-store"><\/code><\/pre>\n\n\n\n

What Else is There to Cache-Control?<\/h2>\n\n\n\n

As you can see from above, the Cache-control uses meta tags. But like most meta tags, they support more than a single value for any directive and the Cache-control is no exception.<\/p>\n\n\n\n

In this case, the allowed values are:<\/p>\n\n\n\n

Public:<\/strong> This states that the content may be cached in public shared caches.
Private:<\/strong> This one hints that the content may only be cached in a private cache.
no-Cache:<\/strong> This value hints that the content may not be cached.
no-Store:<\/strong> Used to tell the caches that the content may be cached but not archived.<\/p>\n\n\n\n

There you have it. You should now be equipped enough to effectively use the HTTP headers for Cache-control.<\/p>\n","protected":false},"excerpt":{"rendered":"

Web developers are always finding new ways to speed up the experience for website visitors. There is one not-so-new way to add to the performance that is not quite used…<\/p>\n","protected":false},"author":1,"featured_media":6789,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,16],"tags":[303,304,320,471,635,636,637,638],"yoast_head":"\nCache-Control HTTP Headers in HTML Pages Explained<\/title>\n<meta name=\"description\" content=\"Here is all you need to know about the Cache-Control HTTP headers as used in HTML pages for websites and web applications\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cache-Control HTTP Headers in HTML Pages Explained\" \/>\n<meta property=\"og:description\" content=\"Here is all you need to know about the Cache-Control HTTP headers as used in HTML pages for websites and web applications\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-01T06:58:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-08T16:23:34+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"How to set HTTP Headers for Cache-Control\",\"datePublished\":\"2018-11-01T06:58:09+00:00\",\"dateModified\":\"2021-12-08T16:23:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\"},\"wordCount\":295,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg\",\"keywords\":[\"HTML\",\"HTTP\",\"Internet\",\"Programming\",\"Web\",\"Web Applications\",\"Web Design\",\"Web Development\"],\"articleSection\":[\"Articles\",\"Guides\",\"Technology\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\",\"url\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\",\"name\":\"Cache-Control HTTP Headers in HTML Pages Explained\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg\",\"datePublished\":\"2018-11-01T06:58:09+00:00\",\"dateModified\":\"2021-12-08T16:23:34+00:00\",\"description\":\"Here is all you need to know about the Cache-Control HTTP headers as used in HTML pages for websites and web applications\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg\",\"width\":1200,\"height\":630,\"caption\":\"Cache-Control\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set HTTP Headers for Cache-Control\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/x.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cache-Control HTTP Headers in HTML Pages Explained","description":"Here is all you need to know about the Cache-Control HTTP headers as used in HTML pages for websites and web applications","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/","og_locale":"en_US","og_type":"article","og_title":"Cache-Control HTTP Headers in HTML Pages Explained","og_description":"Here is all you need to know about the Cache-Control HTTP headers as used in HTML pages for websites and web applications","og_url":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2018-11-01T06:58:09+00:00","article_modified_time":"2021-12-08T16:23:34+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"How to set HTTP Headers for Cache-Control","datePublished":"2018-11-01T06:58:09+00:00","dateModified":"2021-12-08T16:23:34+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/"},"wordCount":295,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg","keywords":["HTML","HTTP","Internet","Programming","Web","Web Applications","Web Design","Web Development"],"articleSection":["Articles","Guides","Technology"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/","url":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/","name":"Cache-Control HTTP Headers in HTML Pages Explained","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg","datePublished":"2018-11-01T06:58:09+00:00","dateModified":"2021-12-08T16:23:34+00:00","description":"Here is all you need to know about the Cache-Control HTTP headers as used in HTML pages for websites and web applications","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/10\/http-chache-control.jpg","width":1200,"height":630,"caption":"Cache-Control"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/cache-control-http-headers-html-explained\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"How to set HTTP Headers for Cache-Control"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/x.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/6788"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=6788"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/6788\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/6789"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=6788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=6788"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=6788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}