AWS Cloudfront as CDN for Heroku Site with Custom Domain AWS Cloudfront as CDN for Heroku Site with Custom Domain heroku heroku

AWS Cloudfront as CDN for Heroku Site with Custom Domain


Domain Name: burger.brianpatrickhummel.com

You will point this to CloudFront, in Route 53... but before you can do that, you need to create a new CloudFront distribution and configure that hostname as an Alternate Domain Name for the distribution.

DNS Target: burger.brianpatrickhummel.com.herokudns.com

Configure this as the Origin Domain Name when creating the distribution CloudFront.

In the Cache Behavior settings, whitelist the Host header so that Heroku will understand which site the request is for.


Here are the steps I would do,

Since you are already on Route 53,

Get a free SSL from ACM

Confirm your SSL verification to the domain email address.Make sure it looks green as below,

ACM Confirmation

Assign it to CloudFront Endpoint with the SSL and CNAME as well

You will also see a cname will be automatically created in Route53 for this SSL endpoint.

If you ping burger.brianpatrickhummel.com, it should respond from the clound front.

Cloudfront SSL

Now setup Origins in Cloudfront to point it to your endpoint with all the cache settings needed. If you don't need cache settings, you can set them all to 0, so cloudfront will not cache any data.

In your Cloudront Pattern make sure you have * at the end so it matches all the url pattern to forward it to your endpoint.

If your endpoint need to be secured, you can pass in additional headers from Cloudfront and make sure the request is orignating from cloudfront, rather than any public endpoint.


I'm uncertain as to of where I make certain DNS/CNAME changes, in Cloudfront, Route 53 or both

Well since Route53 is the DNS service (not CloudFront), then you would be creating the CNAME record in Route53. You want to create a CNAME record in Route53 that points your subdomain to CloudFront. Then you need to configure CloudFront to be aware that it needs to serve that domain by configuring the Alternate Domain Name field.