{"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 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 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 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 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. 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":"\nPragma, the HTTP\/1.0 Implementation<\/h2>\n\n\n\n
<meta http-equiv="pragma" content="no-cache"><\/code><\/pre>\n\n\n\n
Cache-Control, the HTTP\/1.1 Implementation<\/h2>\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
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