To support AMP pages over HTTPS using a CNAME, a reverse proxy must be set up.
This procedure assumes that you have a working web server configured with a CNAME. For the purposes of this tutorial, the CNAME example.com is used.
1 - Create a new distribution on Cloudfront
- Access https://console.aws.amazon.com/cloudfront/home?region=eu-west-1#distributions
- Click the Create Distribution button.
- When prompted, select Web as the delivery method.
2 - Origin settings
- In the Origin Domain Name field, enter the DNS entry that will be provided to you by the Customer Success team. For the purpose of this tutorial, example.com is used as a placeholder.
- The Origin ID is automatically set to Custom-example.com.
- In the Origin Protocol Policy section, select Match Viewer.
3 - Default cache behavior settings
In the Default Cache Behavior Settings:
- Select HTTP and HTTPS in the Viewer Protocol Policy section.
- Select Use Origin Cache Headers in the Object Caching section.
- Select None in the Forwarding Cookies field.
- Select None in the Query String Forwarding and Caching field.
4 - Distribution settings
- For optimal performance, set Price Class to Use All Edge Locations.
- In the case of alternate domain names, you must list any custom domain names (in this case, example.com) that you use in addition to the CloudFront domain name (for example, d1234.cloudfront.net) for the URLs for your files. Specify up to 100 CNAMEs separated with commas or put each on a new line. You must also create a CNAME record with your DNS service to route queries for example.com to d1234.cloudfront.net.
- If you select to enable logging, you would need to create a Bucket in the S3 Console, required to store web server logs. This is also where you will select that bucket.
- Set Distributon State to Enabled.
5 - Create distribution
Finally, click the Create Distribution button, which should elicit the following message:
A domain name has been generated for your CloudFront distribution: d**************q7.cloudfront.net.
The service is now syncing with your site. The Status will change to "Deployed" once it completes, and that usually takes about 10 minutes.