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

CloudFront - Specify a Default Root Object (Download Distributions Only)

When you deliver your content using AWS CloudFront service, you can assign a homepage, which will be served when the user requests the Distribution name, without requesting a specific Object name in the URL. To assign this default page to be served, you can assign a default root Object for your Amazon CloudFront distribution, while creating new or updating existing distribution.

The default object is the file that you will assign for your distribution. When a user makes a request to your distribution http://www.mydomain.com without having a specific object name in URL, your distribution will return the default root object in response as a home page for your website.

You can specify Default Root Object by sending the POST Request either using Amazon CloudFront API POST Distribution OR using Bucket Explorer User Interface. To use Amazon CloudFront API, you will need to write your own software program, however, if you do not want to write your program, you can use Bucket Explorer User Interface to specify/set Default Root Object in Download distrbution using mouse clicks.

The below two sections describe how you can specify/set Default Root Object using the POST Distribution request in your code or using Bucket Explorer.

1. Specify Default Root Object in Download Distribution Using REST API- POST Distribution

Specifying default root object for your Amazon CloudFront distribution is only applicable for Download Distributions.


POST /2013-05-12/distribution HTTP/1.1
Host: cloudfront.amazonaws.com
Authorization: AWS authentication string
Date: time stamp
Other required headers
<?xml version="1.0" encoding="UTF-8"?>
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
<DefaultRootObject> URL for default root object </DefaultRootObject>
...<REMAINING XML DOC>
</DistributionConfig>
 

2. Specify Default Root Object in Download Distribution Using Bucket Explorer

Follow these steps to set default object for a CloudFront distribution:

  1. Start Bucket Explorer and connect with your Amazon S3 Account.
  2. Choose "Distribution --> List Distribution" icon in Bucket table toolbar or right click on any bucket and click on "Manage Distribution" option.
  3. It will display a "List distribution" window with the list of existing distributions.
  4. To create new download distribution, choose "New" button in toolbar of List distribution window or to update any existing download distribution, select a particular distribution from the list which Distribution Type in column is NOT STREAMING and click on "Update" button in the toolbar.
  5. It will open a window- General Distribution Details , where you can add/update information about CNAME, price class, comment, logging and other options.
  1. You will find a text box labeled " Default Root Object ".
  2. If you want to set default root object, enter the S3 object name in the text box for "Default Root Object".
  3. Click on Next and you will get a window - Origin Details .
  4. Here you can select S3 Bucket from the drop down list and insert Origin Access Identity details.
  5. Click on Add to add details in table with origin details and click on Next .
  6. Now you will get Cache Behavior Details panel.
  7. Enter Path pattern .
  8. Add AWS Account Number in Trusted Signers list.
  9. Select Viewer Protocol policy : Allow all or Https only.
  10. Set Min TTL. Default to Zero .
  11. Select Query String as ON or OFF
  12. Select Forward Cookies type - All, WhiteList or None
  13. Select the check box " Make it Default ".
  14. Then click on Add button to add these details in the below Cache Behavior Details table.
  15. Finally click on "Create" button.
  16. Click on refresh button and check Status column. Wait until distribution is deployed.
  17. Copy the Domain Name by right clicking on the recently deployed distribution.
  18. Now open your browser, copy "URL" having only the domain name in the address bar. E.g. http://d2itscowvyh1n1.cloudfront.net/
  19. Your browser will now open the default object you specified for this distribution.