{"id":243,"date":"2016-06-01T15:53:00","date_gmt":"2016-06-01T11:53:00","guid":{"rendered":"http:\/\/yohoho.msp360.com\/?p=243"},"modified":"2021-01-26T16:55:10","modified_gmt":"2021-01-26T12:55:10","slug":"how-to-set-custom-http-headers-for-amazon-s3-objects","status":"publish","type":"post","link":"https:\/\/www.msp360.com\/resources\/blog\/how-to-set-custom-http-headers-for-amazon-s3-objects\/","title":{"rendered":"How to set custom HTTP headers for Amazon S3 objects with MSP360 Explorer"},"content":{"rendered":"<p>In MSP360 we are trying to make what works best for our customers and custom <b>HTTP headers<\/b> are no exception. This is something that was brought up many times.<!--more--><\/p>\n<div class=\"table-of-content \">\n\t\t\t\t<p>Table of Contents<\/p>\n\t\t\t\t<ul><\/ul>\n\t\t\t\t<\/div>\n<h2>Why Should I Care About Custom HTTP Headers?<\/h2>\n<p>If you are using Amazon S3 to serve your files over HTTP sometimes you need additional flexibility that custom HTTP headers could provide. \u00a0For instance, if you properly set <b>Cache-Control<\/b> HTTP header, it will help you to <b>reduce your Amazon S3 bills<\/b>.<\/p>\n<p>There are two ways you can configure HTTP headers using MSP360 Explorer. You can set up HTTP-headers for the files already located in S3 buckets or configure them right before copying files to S3.<\/p>\n<h2>How to Set Custom HTTP Header for Files Already Stored on Amazon S3<\/h2>\n<div class=\"steps\">\n<p><var>1<\/var> Just select the file you want to set headers for and right-click it. You will see an option called <b>Set HTTP Headers <\/b>in the context menu. The same option is available on the toolbar.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31582 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-20-14.png\" alt=\"\" width=\"259\" height=\"307\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-20-14.png 259w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-20-14-253x300.png 253w\" sizes=\"auto, (max-width: 259px) 100vw, 259px\" \/><\/p>\n<p><var>2<\/var>You will get the windows with the list of HTTP headers like the one below. The list shows the headers that are already assigned to the file. Most of them are assigned by Amazon S3 by default.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31583 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-22-40-2.png\" alt=\"\" width=\"506\" height=\"501\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-22-40-2.png 506w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-22-40-2-150x150.png 150w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-22-40-2-300x297.png 300w\" sizes=\"auto, (max-width: 506px) 100vw, 506px\" \/><\/p>\n<p><var>3<\/var>If you want to add a custom HTTP header just click the add button and choose the header from the list. You can also type a name of the header manually if it is not there.\u00a0\u00a0 For our example with will set <b>Cache-Control<\/b> header.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31584 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-24-12.png\" alt=\"\" width=\"403\" height=\"249\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-24-12.png 403w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-24-12-300x185.png 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/p>\n<p><var>3<\/var>Then choose the value for the header from the list.\u00a0 Note that the list is filled with predefined values, but you can always type in your own value.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31585 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-25-04.png\" alt=\"\" width=\"403\" height=\"166\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-25-04.png 403w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-25-04-300x124.png 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/p>\n<p><var>4<\/var>Click ok and the new header will appear in the list.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31586 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-25-54.png\" alt=\"\" width=\"503\" height=\"509\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-25-54.png 503w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-25-54-296x300.png 296w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/p>\n<p>Click <b>ok<\/b> once again and ok on the confirmation dialog. The header will be applied to the file on S3.\u00a0 Next time someone requests this file from the web browser, the new HTTP header will take effect.<\/p>\n<\/div>\n<h2>Can I Set Headers for Multiple Files at Once?<\/h2>\n<p>Yes! Just multi-select the files that you want to set headers for and follow the instructions above.<\/p>\n<h2>How to Set Custom HTTP Headers for Files that I Want to Copy to S3<\/h2>\n<p>It is very easy to set custom HTTP headers to the files when they are copied to Amazon S3.\u00a0 When you copy files a confirmation dialog now has <b>Set HTTP headers<\/b> link. If you click on it the same window will come up and you will be able to manage HTTP headers. Just follow the steps above.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31587 aligncenter\" src=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-28-16.png\" alt=\"\" width=\"384\" height=\"151\" srcset=\"https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-28-16.png 384w, https:\/\/www.msp360.com\/resources\/wp-content\/uploads\/2009\/06\/2019-06-24_20-28-16-300x118.png 300w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/p>\n<h2>Cache-Control and Amazon CloudFront<\/h2>\n<p>When you use Amazon CloudFront service Cache-Control header is becoming even more important. \u00a0CloudFront edge servers will check S3 to see if the object has changed after the expiration time you set on your object.\u00a0 If you have set no expiration time on your object, the default is <b>24 hours<\/b>.\u00a0 When that check is made, if the object is S3 has changed, the new object will go into the edge location.<\/p>\n<h2>Looking Ahead<\/h2>\n<p>Besides the caching, we are also looking into <b>GZIP support<\/b> that will help you to serve compressed files from S3. Not only will it help you to lower your bills but also to serve your content faster!<\/p>\n<h2>Conclusion<\/h2>\n<p>With the ability to set custom HTTP headers MSP360 Explorer is becoming a compelling tool for Amazon S3 users, in particular to web site developers who want to have granular control on how the files are handled by the web browser. What\u2019s more caching is what can significantly lower your Amazon S3 monthly bills.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In MSP360 we are trying to make what works best for our customers and custom HTTP headers are no exception. This is something that was brought up many times.<\/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-243","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\/243","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=243"}],"version-history":[{"count":0,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts\/243\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/media?parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/categories?post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/tags?post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}