download free 30 days trial version buy bucket explorer
Documentation  Download  Purchase  Support  FAQs   Forum   ScreenShots & Demos

How to Set Cache Control Header for S3 File Using Bucket Explorer?

Cache Control Metadata has a vital role in Object behavior while requesting through browser. Cache Control is used for lowering the number of access to S3 Objects , We can access the content which are already exist in the browser cache. This is achieved by adding custom header Cache-control and Expiration Time, b ecause objects are loaded from cache without requesting to the S3 so they can access faster.  Cache control will access the object from cache up to specified time limit set by user and by default it is 24 hours for every object.

Every Metadata has a Key-Value pair . Same Cache control metadata Key is "Cache-Control" and Value is "max-age=< time for which you want your object to be accessed from cache in seconds >"

You can set metadata like Cache-Control and other using Bucket Explorer. Bucket Explorer providing three different ways to set Metadata :

  • You can set Cache-Control while uploading using  Upload with Custom Headers  option.
  • You can set Cache-Control for each file being uploaded using  Bucket Default  option  .
  • You can also set Cache-Control for already upl oaded file on S3 using   update meta-data  in single as well as batch operation.

Follow the steps below to set  Cache-Control as Metadata on S3 File Using Bucket Explorer:

Case A : Set Cache-Control while uploading using Upload with custom Header :

  1. Run Bucket Explorer and login with your credentials.
  2. After listing all Buckets, select any S3 Bucket.
  3. Select files from native file system (from left tree panel).
  4. Right click on files and select “upload with custom header”
  5. Now custom header window appears.
  6. Click on add Button to add custom header, Enter Key :"Cache-Control" with Value : "max-age= (time for which you want your object to be accessed from cache in seconds)”  e.g. value= " max-age= 1296000"
  7. Add Custom header and now file is uploaded with custom header.

Case B : Set Cache-Control for each file being uploaded using Bucket Default : 

By this method you can set the cache-control by default on every object which are uploaded in this bucket.

  1. Run Bucket Explorer and login with your credentials.
  2. After listing all Buckets, select any S3 Bucket.
  3. Click on Bucket Default tool button, exists on Bucket Table.
  4. Select set option and add default custom-header, Enter Key :"Cache-Control" with Value :" max-age= (time for which you want your object to be accessed from cache in seconds)”.
  5. Set as a Bucket Default.
  6. Select any file from local system and click to upload button
  7. Cache-Control metadata will be set on each newly uploaded file.

Case C : Set Cache-Control for already uploaded file on S3 using  Update meta-data :

  1. Run Bucket Explorer and login with your credentials.
  2. After listing all Buckets, select any S3 Bucket.
  3. It will list all objects of selected S3 Bucket.
  4. Select any file and do right click on the objects and select " Update Metadata " option.
  5. Add Key and value in meta data attributes,  Enter Key :Cache-Control with Value : "max-age= (time for which you want your object to be accessed from cache in seconds)”.
  6. Click on Save button, it will update metadata as Cache-Control on all selected S3 Objects.

 

Example to set max-age : For time limit of 15 days= 3600 * 24 * 15 = 1296000  sec, Set Key="Cache-Control" value="max-age=1296000" 

Note: If object is HTML file then set  Key :"Cache-control" and value :max-age=(time for which you want your object to be accessed from cache in seconds), must-revalidate ". i.e  Key:"Cache-control" value:max-age="2592000,must-revalidate" for 30 days. "must-revalidate" string must be added after the time in second as value.