Search code examples
amazon-web-servicessslherokuamazon-cloudfrontamazon-route53

How to configure a Amazon Route with SSL for a Heroku App


I need to set an Amazon Domain as a custom domain for a Heroku app. I found the next tutorial https://devcenter.heroku.com/articles/route-53 but it doesn't work if the app needs https requests. The first idea was to set up the SSL Certificate in Heroku, but the SSL Amazon Domain manager doesn't allow to download the certificate, so the SSL need to be managed by AWS.
What is the best way to add Amazon SSL to a Heroku app?


Solution

  • The best option I found was to create an AWS CloudFront and configure it like Karan describes in his answer but with some add-ons:

    1. Create a certificate from AWS Certificate Manager and approve it.

    2. Create a CloudFront distribution with the Origin Domain Name as your Heroku URL such as myapp.herokuapp.com and the custom SSL certificate as the one you created from the AWS Cert Manager.

    3. While creating the distribution, make sure that you have the TTL as 0, else all the responses will be cached enter image description here enter image description here If you don't complete this step probably you will get an error like this:

      This distribution is not configured to allow the HTTP request method that was used for the request. The distribution supports only cachable requests. enter image description here

    4. Follow the guide I mention in the question [https://devcenter.heroku.com/articles/route-53][4]