Blog Articles
Read MSP360’s latest news and expert articles about MSP business and technology
CloudBerry Explorer featured image

Two Ways to Setup Content Expiration with MSP360 Explorer for Amazon S3

Two Ways to Setup Content Expiration with MSP360 Explorer for Amazon S3

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 a popular website such as TechCrunch the number of visitors suddenly jumps tenfold.

One of the things that have been successfully employed by professional webmasters to improve scalability and lower the web server load is content caching.

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.
The 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.
Content Expiration can be controlled using two HTTP-headers: Expires and Cache-Control.

Expires Header

Expires header supports exact date and time
Expires: Thu, 9 Sep 2009 14:19:41 GMT
To configure any header you can select the file(s) on S3 and click Set HTTP Headers in the toolbar.

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.

Cache-Control Header

Cache-Control supports relative time. Below are some popular values for Cache-Control Header:
max-age=[seconds] — 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.
s-maxage=[seconds] — 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:
90 days * 24 hr * 60 min * 60 sec = 7776000 sec
This will give us a value for the max-age parameter and here is how it should look like:
Cache-Control: public, max-age=7776000,

After setting this header your content will expire in 3 months

Other common values for Cache-Control

- public — marks authenticated responses as cacheable; normally, if HTTP authentication is required, responses are automatically uncacheable (for shared caches).- no-cache — 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 — instructs caches not to keep a copy of the representation under any conditions.

- must-revalidate — tells caches that they must obey any freshness information you give them about a representation. HTTP
allows caches to serve stale representations under special conditions; by specifying this header, you’re telling the cache that you want it to strictly follow your rules.
c
- proxy-revalidate — similar to must-revalidate, except that it only applies to proxy caches.

Note: Cache validation rules depend on some other response/request headers like:

Response Headers
ETag (in our case read-only), Last-Modified (in our case read-only, means the filestamp), etc
Request headers (mostly auto-generated by the browser and/or proxy server)
If-Match, If-Modified-Since, etc.

Conclusion

Smart content caching allows you to improve the scalability of your website and lower your Amazon S3 bills. Luckily Amazon S3 supports content expiration and MSP360 Explorer makes it very easy to configure.

CloudBerry Explorer for Amazon S3
  • File management in Amazon S3 and S3-compatible storage
  • Encryption and compression
  • IAM and security management
New call-to-action
Explorer icon