Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DNS with Heroku and Google Domains - SSL forwarding

I am hosting a website at example.herokuapp.com. I own the domain example.com on Google Domains (Registrar). I also have GSuite setup for this domain (email).

I'd like to forward everything to either https://www or https://.

So far, I can get:

[Failure] https://example.com/ -> "This site can’t be reached" Chrome error page
[Success] http://example.com/ -> https://www.example.com/
[Success] https://www.example.com/ -> https://www.example.com/
[Failure] http://www.example.com/ -> http://www.example.com/

In Google Registrar, I have:

Name Servers 
  Use the Google Domains name servers

Synthetic records
  example.com -> https://www.example.com (302)

Custom resource records
  NAME |  TYPE | TTL |                          DATA
  -----+-------+-----+------------------------------
     @ |    MX |  1h |         10 aspmx.l.google.com. (and others) <- mail
   www | CNAME |  1h | www.example.com.herokudns.com. 

Running heroku domains gives me

www.example.com  www.example.com.herokudns.com
example.com      example.com.herokudns.com

Running heroku certs:auto gives me

www.example.com  DNS Verified
example.com      Failing

How do I get the two failing urls to work?

My hypothesis is I need another CNAME for example.com.herokudns.com but I can't add one for @.

like image 805
woodpav Avatar asked Jun 28 '17 16:06

woodpav


1 Answers

I have gotten this to work via the following steps:

  1. In Heroku, Settings > Domains and Certificates: Configure SSL, Select Automatically - Automated Certificate Management

  2. Copy the DNS Target that looks something like: www.sitename.com.herokudns.com

  3. In Google DNS, My Domains > Configure DNS Synthetic Records. In subdomain, input the actual site address again. I know that it sounds like this shouldn't work, but typing in the domain name as the subdomain forces Google DNS to just do the synthetic record as the standard raw domain. It ends up looking like website.com .website.com --> https://www.website.com. Check Temporary redirect, Do not forward path, Enable SSL.

  4. Custom resource records -- Name: www, Type CNAME, TTL: 1h, Data: DNS Target copied from step 2.

If the user types in website.com or http://website.com, it will properly redirect to https://www.website.com. I can't seem to get www.website.com to redirect and have resorted to using the options here.

Hope this helps!

like image 61
Dan Avatar answered Sep 19 '22 23:09

Dan