{"id":234,"date":"2016-07-20T16:00:00","date_gmt":"2016-07-20T12:00:00","guid":{"rendered":"http:\/\/yohoho.msp360.com\/?p=234"},"modified":"2022-05-16T15:59:02","modified_gmt":"2022-05-16T11:59:02","slug":"two-ways-to-configure-content-expiration-with-explorer","status":"publish","type":"post","link":"https:\/\/www.msp360.com\/resources\/blog\/two-ways-to-configure-content-expiration-with-explorer\/","title":{"rendered":"Two Ways to Setup Content Expiration with MSP360 Explorer for Amazon S3"},"content":{"rendered":"<p><a href=\"https:\/\/www.msp360.com\/explorer\/amazon-s3.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon S3 browser by <\/a>MSP360 is a powerful Windows program that helps to manage all aspects of <a href=\"http:\/\/aws.amazon.com\/s3\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Amazon S3<\/a> storage. Many people use Amazon S3 to host their media content or entire websites to offload static content from their web servers, increase scalability or deal with so-called TechCrunch effect, when after publishing a review on a popular website such as TechCrunch the number of visitors suddenly jumps tenfold.<!--more--><\/p>\n<p>One of the things that have been successfully employed by professional webmasters to improve scalability and lower the web server load is content caching.<\/p>\n<p>Content caching is a directive to the client browser to store a certain file that rarely changes such as the image on a local computer. Next time the user requests the same page, the cached content is taken from the local computer rather than requested from the web server. Not only it allows for better user experience but also for less load on the web server.<br \/>\nThe additional benefit of employing content caching on S3 is that every request to S3 is charged and under some circumstances, you can lower your bills significantly if you use smart caching strategy.<br \/>\nContent Expiration can be controlled using two HTTP-headers: Expires and Cache-Control.<\/p>\n<h2>Expires Header<\/h2>\n<p>Expires header supports exact date and time<br \/>\nExpires: Thu, 9 Sep 2009 14:19:41 GMT<br \/>\nTo configure any header you can select the file(s) on S3 and click Set HTTP Headers in the toolbar.<\/p>\n<p>In the popup up dialog, click Add and locate in this case Expires header. To make it easier we show the exact format for the header value in example. Type the value appropriate for your content.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31495 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-44-03.png\" alt=\"\" width=\"507\" height=\"505\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-44-03.png 507w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-44-03-150x150.png 150w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-44-03-300x300.png 300w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-44-03-250x250.png 250w\" sizes=\"auto, (max-width: 507px) 100vw, 507px\" \/><\/p>\n<h2>Cache-Control Header<\/h2>\n<p>Cache-Control supports relative time. Below are some popular values for Cache-Control Header:<br \/>\nmax-age=[seconds] \u2014 specifies the maximum amount of time that representation will be considered fresh. Similar to Expires, this directive is relative to the time of the request, rather than absolute. [seconds] is the number of seconds from the time of the request you wish the representation to be fresh for.<br \/>\ns-maxage=[seconds] \u2014 similar to max-age, except that it only applies to shared (e.g., proxy) caches. for example, relative expires for 3 months(90days). To calculate the correct value you should do some math:<br \/>\n90 days * 24 hr * 60 min * 60 sec = 7776000 sec<br \/>\nThis will give us a value for the max-age parameter and here is how it should look like:<br \/>\nCache-Control: public, max-age=7776000,<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31496 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-45-27.png\" alt=\"\" width=\"403\" height=\"166\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-45-27.png 403w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/07\/2019-06-20_21-45-27-300x124.png 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><br \/>\n<span style=\"font-size: 1rem;\">After setting this header your content will expire in 3 months<\/span><\/p>\n<h2>Other common values for Cache-Control<\/h2>\n<p>- public \u2014 marks authenticated responses as cacheable; normally, if HTTP authentication is required, responses are automatically uncacheable (for shared caches).- no-cache \u2014 forces caches to submit the request to the origin server for validation before releasing a cached copy, every time. This is useful to assure that authentication is respected (in combination with the public), or to maintain rigid freshness, without sacrificing all of the benefits of caching.- no-store \u2014 instructs caches not to keep a copy of the representation under any conditions.<\/p>\n<p>- must-revalidate \u2014 tells caches that they must obey any freshness information you give them about a representation. HTTP<br \/>\nallows caches to serve stale representations under special conditions; by specifying this header, you\u2019re telling the cache that you want it to strictly follow your rules.<br \/>\nc<br \/>\n- proxy-revalidate \u2014 similar to must-revalidate, except that it only applies to proxy caches.<\/p>\n<p>Note: Cache validation rules depend on some other response\/request headers like:<\/p>\n<p>Response Headers<br \/>\nETag (in our case read-only), Last-Modified (in our case read-only, means the filestamp), etc<br \/>\nRequest headers (mostly auto-generated by the browser and\/or proxy server)<br \/>\nIf-Match, If-Modified-Since, etc.<\/p>\n<h2>Conclusion<\/h2>\n<p>Smart content caching allows you to improve the scalability of your website and lower your <a href=\"http:\/\/aws.amazon.com\/s3\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Amazon S3<\/a> bills. Luckily Amazon S3 supports content expiration and <a href=\"https:\/\/www.msp360.com\/explorer\/amazon-s3.aspx\">MSP360 Explorer<\/a> makes it very easy to configure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Amazon S3 browser by MSP360 is a powerful Windows program that helps to manage all aspects of Amazon S3 storage. Many people use Amazon S3 to host their media content or entire websites to offload static content from their web servers, increase scalability or deal with so-called TechCrunch effect, when after publishing a review on [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[877,898,882],"tags":[],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-blog-articles","category-msp360-explorer","category-msp360-news"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":1,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":54030,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts\/234\/revisions\/54030"}],"wp:attachment":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}