How to handle two domains and forward everything (non www and www) to one Heroku app? - ssl

I have 2 domains, one at Register.com and one at Godaddy. I need them both to point to one Heroku app, and the following scenarios to work:
http://domain1.com
http://domain2.com
http://www.domain1.com
http://www.domain2.com
https://domain1.com
https://domain2.com
https://www.domain1.com
https://www.domain2.com
All of the above should all end up at one heroku app at https://www.domain1.com
Being that it's Heroku, I have no access to the .htaccess, and I've heard you're only allowed one SSL cert per app. I also have forwarding setup at GoDaddy, but apparently forwarding does not work if you try to forward from https on a non-hosted app.

Your cert has to match the domain name that the client will try to answer, this means that when you make it the Subject Alternative Names (SANs) have to include www.domain1.com, domain1.com, www.domain2.com, domain2.com, and the domain/ip of your actual heroku app.
For your DNS records, if the heroku app is at a Fully Qualified Domain Name (FQDN), and not an ip then follow these steps:
Forward your root domain, e.g. example.com to www.example.com, and make the CNAME record www. 300 IN CNAME domain.of.heroku.app
If the heroku app is reachable at a static ip follow this:
Make an the following A records for both your domains:
# 300 IN A ip-here

Related

Why won't my https://domain forward to www?

I have a website for my podcast built with Python / Django that is hosted on Heroku: https://dinpodcast.herokuapp.com/
I have a custom domain parked on GoDaddy, dinpodcast.com, that has a www CNAME directing to my heroku application. This works just fine: https://www.dinpoddcast.com
I wanted dinpodcast.com to redirect to the www website, so I have the following domain forwarding set up on Godaddy:
This also works great, for the most part. Now, when I enter http://dinpodcast.com, or just dinpodcast.com, both will redirect to https://www.dinpodcast.com.
Here's the problem. When I enter the naked domain WITH HTTPS, so when I enter https://dinpodcast.com into a browser's address bar, I get the following response:
Here's what I THINK is happening. My SSL certificate is provided by Heroku under their Automated Certificate Management program. So, I assume that since I don't have an SSL certificate with GoDaddy, it's timing out trying to find one before it can redirect to my www subdomain. Would this be correct? If so, is there any way around this WITHOUT buying an SSL certificate with GoDaddy? If that's not what's happening, then what is and how do I fix it?
When you create an ssl certificate in your domain do you include your root domain? Tried using this tool in your root domain and it seems that there is no ssl certificate. However the subdomain https://dinpodcast.herokuapp.com/ has one. I suggest putting an ssl certificate in all subdomain and root domain that you are using.
I also checked the root domain’s IP address using this tool and checked port 443 using another tool and apparently the port is closed. Double check your firewall and make sure 443 is open.

Why is my IONOS 1&1 root not redirecting correctly over ssl?

I have a 1&1 IONOS domain for my heroku app. the www subdomain works fine, with a CNAME setup for it. but I'm trying to redirect the root url to the www subdomain. this also works fine for http, but if the url is typed in as https://example.com, I get a ERR_SSL_PROTOCOL_ERROR (on chrome, other browsers have different errors). this is on any device, regardless of clearing cache and history etc.
my heroku logs show it's never reached, so it must be an issue within 1&1.
theres an ssl cert set on the domain with 1and1, as well as heroku's ACM.
any ideas?
To make the four URL variations (http://example.com, http://www.example.com, https://example.com, and https://www.example.com) point to a different SSL hosted site (heroku, cloudfront, etc), you need three things in IONOS:
Under DNS settings, add a CNAME entry for the www subdomain that points to your SSL hosted site (example.herokuapp.com)
Set up an HTTP Redirect under Domain Forwarding to https://www.example.com (don't check the box that states "Also set up for www subdomain")
Make sure you have an SSL wildcard certificate for *.example.com installed and attached to your domain in IONOS
It looks like all you are missing is number 3. After that, the redirect that you have setup should work as expected.
Note: example.com should be replaced by your actual domain in all of the above.

Heroku naked domain problem with Google Domains

I have a question about Heroku.
When I try to add new domain with example.
the new domain has to be www.example.com.
If I use example.com. it has ACM problem, no matter how I change the setting in google domains, it goes wrong.
Then fine, I keep the www.example.com one, and web works with setting in google domain
www CNAME 1h www.example.com.herokuapp.com
however, for some reason, I need to add a new subdomain:
auth.example.com
and in my googles domain setting,DNSdata is connect others,not heroku
auth CNAME 1H someDNSdata
then the problem comes out, there is automatically SSL for my web, but it only apply to www.example.com. it doesn't apply to auth.example.com.
i can't adda new domain auth.example.com in heroku because there is
auth CNAME 1H someDNSdata
in the google setting.
I want my SSL in heroku apply for all subdomain.so what should i do??
PS:i have forward
example.com -->https://www.example.com
in additional problem,
if i type www.example.com,it goes http one,
if i type example.com, it goes https one.
why would that happen?? I set # in subdomain forwarding, but it comes out
example.com -->https://www.example.com
doesn't # mean all subdomain will go to https://www.example.com??

Heroku naked domains with DNS & SSL

I've been struggling with the configuration of my DNS app on Heroku. Things I want to accomplish:
www.example.com and example.com , both with SSL config (HTTPS)
Things I tried so far ...
GoDaddy Settings:
CNAME | www | example.com.herokudns.com
FOWARDING to
https://www.example.com
However, this setup is working great with HTTP only, but I'm getting a "Your connection is not private" error when I type the https.
I checked several tutorials and none address this issue.
PS: I'm using the SSL automatically managed from heroku.
SOLVED IT
Getting the naked domain set up with Godaddy easily: Set forwarding to your domain: https://www.my-domain.com. This will redirect non www to the correct place.
With that, I don't actually need to add a second domain in heroku (example.com).
Just keep the www.example.com, turn the SSL on, go to go daddy and redirect. This is working for me so far....

What should I put in Host Name when buying a DNSimple SSL certificate for it to work with the Heroku ssl addon?

I'm confused with this line in the Heroku docs (https://devcenter.heroku.com/articles/ssl-certificate)
You must enter a subdomain in the “Host Name” field. Leaving it blank will generate a root-domain certificate which is not compatible with Heroku’s SSL endpoint.
What I want is https://foo.com and https://www.foo.com to work.
So what do I need to fill in this field to get a SSL certificate that will help me achieve the above?
The rest of the steps (setting CNAME to Heroku's SSL endpoint, adding an ALIAS to redirect the root domain etc) are clear to me. I'm just stuck on this step, should it be blank or 'www' or something else?
If you want your certificate to be valid for the rood domain AND the www hostname, then you should use the www.example.com version.
You can also purchase a wildcard, but unless you need to support any extra subdomain, the cost is not worth in this case.
More details are available in the support page Selecting the Certificate Hostname.
You should fill in www.
www is just a subdomain so that will solve your www.foo.com problem but you will have to redirect the naked domain https://foo.com to the www one though.
Enter "*" for your host name, it will be valid for all subdomains including the root subdomain.