Setting up Bucket Access
Select Access Control List from the Permissions tab for the bucket
- Select Everyone and enable List Objects to grant public access to only view objects
Setting Up the CDN
This example uses a bucket named
stackpathtesting within the
us-east-2 region, please replace any instance of
stackpathtesting or <bucketname> with the actual name of your bucket and any instance of
us-east-2 or <aws-region> with the actual region for your bucket.
Log in to StackPath
Create a new CDN Site
Enter the Delivery Domain you would like to use. This can be any valid domain name, but for this example, the bucket address was used.
Select Amazon S3 as server type
- Set the Bucket URL to
View the newly created CDN site and select the Settings tab to confirm the Host Header
- Now, set a custom Host Header for
s3.<aws-region>.amazonaws.comif you used
s3.<aws-region>.amazonaws.com/<bucketname>. You can do this by clicking the 'Add Custom' button and then entering the custom Host Header in the new input box. Finally, click save to add and set this Host Header.
Test the CDN URL by visiting it with the browser. This should produce an XML File that contains an index of all of the objects within the bucket. Once this is confirmed, you can now serve your bucket objects over the CDN Cache using
http://cdn.url/path/to/bucket/object (And replacing cdn.url with the CDN URL was generated upon creating the CDN Site)
Connecting the StackPath CDN can be useful for