Heroku SSL security certificate not working: CNAME from Namecheap domain - ruby-on-rails

I am trying to set up a CNAME Record from my Namecheap domain to my Heroku app. I understand that Heroku offers a free SSL certificate if you use the default name rather than a custom domain. I am using a default name (example.herokuapp.com).
On Safari, I receive a "untrusted" popup and then it proceeds to load; on Firefox, I receive a connection untrusted:
www.example.com uses an invalid security certificate. The certificate is only valid for the following names: *.herokuapp.com, herokuapp.com (Error code: ssl_error_bad_cert_domain)
And Chrome refuses the connection.
My Namecheap Advanced DNS is set up as follows:
Type | Host | Value | TTL |
CNAME Record | www | example.herokuapp.com | 30 min|
URL Redirect Record | # | http://www.example.com [Masked] | |
heroku domains looks like this:
example Heroku Domain
example.herokuapp.com
example Custom Domains
Domain Name DNS Target
www.example.com example.herokuapp.com
example.com example.herokuapp.com
Is there something I am doing wrong that is causing this problem? My goal is to have the user be able to load the page by going to example.com, www.example.com, http://example.com, http://www.example.com, https://example.com, and https://www.example.com.
Thank you.

As you mentioned, Heroku only allow you to use their free SSL for the default example.herokuapp.com. You have to purchase your own SSL certificate if you want to use https for your own custom domain like example.com or www.example.com

Related

how can i point my bastion host ec2 which don't have any public ip with godaddy domain?

I have a bastion host ec2 ,which don't have any public IP address ,but i have one application load balancer which is integrated with private EC2 ,but when I added CNAME(ALB DNS Record) record with host name WWW in my Godaddy DNS records So my website works only with https://www.example.com ,all other urls like -
https://example.com,
http://example.com do not work.
after that I had use the domain forwarding feature of godaddy but through this feature I can forward only one url like- example.com to www.example.com but I want my all urls should work fine.
Do we resolve this issue by help of A record?
I added CNAME(ALB DNS Record) record with host name WWW in my Godaddy DNS records but my website works only with https://www.example.com .
I had use the domain forwarding feature of godaddy but through this feature I can forward only one url like- example.com to www.example.com .
I would suggest you start using AWS Route53 to manage the DNS records, after that, you can create A record to point to the ALB. You would have to create a hosted zone for example.com, then copy the name servers of it and use update your Godaddy configuration to use AWS name servers. More information can be found here: https://virtualizationreview.com/articles/2020/07/14/migrating-dns-services-aws.aspx

How do I ensure my site loads when the user uses the root domain name prefixed with HTTPS?

I'm trying to set up SSL on my site that runs on Rails on Heroku. If I type any of following into the address bar of my browser, it loads:
www.example.com
example.com
https://www.example.com
But when I enter https://example.com (the root domain prefixed with https) Safari displays "This connection is not private". Why?
I have added www.example.com and example.com to my Heroku app.
heroku domains:add www.example.com
heroku domains:add www.example.com
I have configured the domain's CNAME and ALIAS to point to the DNS targets provided by Heroku.
Alias: # aaaaaa.herokudns.com.
CNAME: www bbbbbb.herokudns.com.
I have used heroku certs:auto:enable to configure Heroku to manage my site's SSL certification.
I have configured rails to force ssl in production:
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
What do I need to do to ensure that the site loads correctly when the user enters the root domain prefixed with https into the URL bar?

Heroku Automated Certificate Management not working

I have a domain, example.com. It's running on hobby dynos in Heroku, so I figured I would enable Heroku Automated Certificate Management. I've set up Heroku like so:
=== example Custom Domains
Domain Name DNS Target
─────────────── ─────────────────────────────
example.com example.com.herokudns.com
www.example.com www.example.com.herokudns.com
My DNS settings are:
CNAME Record www example.com.herokudns.com.
URL Redirect Record # https://www.example.com Unmasked
However, neither the apex domain (example.com) or the www domain (www.example.com) work when I access the domain.
Help would be greatly appreciated.

Create a subdomain on Namecheap for a Heroku Rails app

I have a domain name registered on namecheap. Let's say it is mysite.com. I want this domain to be my personal site. I also want to create a subdomain like myapp.mysite.com for a Rails app on Heroku.
I have tried to configure one in the DNS section of the Namecheap dashboard but I'm new with theses things. I'm using a CNAME type, # for host and automatic for TTL.
I have also added myapp.mysite.com as a custom domain in my Heroku dashboard.
Am I doing this right? Please explain it in detail so I can learn more about DNS.
EDIT:
I have changed my subdomain like this:
Type: CNAME
Host: myapp
Value: mysite.om
TTL: Automatic
Since the DNS has updated, I now get a 400 bad request error from Nginx.
Is it because of Heroku? Do I have to add some setting in Heroku?
I have found the solution for my question. So first of all, the correct configuration for the advanced DNS:
Type: CNAME
Host: myapp
Value: myapp.herokuapp.com (without the https protocol)
TTL: Automatic
After that, it takes a moment for the DNS to update the subdomain and make it available. During this time, I needed to add my subdomain to my Heroku configuration. It is possible via the dashboard of via terminal.
I did it via terminal with this command:
heroku domains:add myapp.mysite.com
After some time, it finally worked. However, having a custom domain or subdomain disable the default SSL from Heroku.
I mostly learn via this article:
https://devcenter.heroku.com/articles/custom-domains
The selected answer didn't work for me. But following the docs did.
Open terminal
heroku domains:add www.example.com
host www.example.com
Copy the url that looks like: whispering-willow-5678.herokudns.com
Note It will always be suffixed by .herokudns.com
Add a CNAME Record with the host (www, in my example).
Paste in the url you copied under Value (see screenshot below).
Click the check mark on Namecheap
Profit
Resources
Heroku Docs
Namecheap Docs

Heroku SSL with website subdomain causing security warnings in browser

I keep getting security certificate errors when I access my Heroku app connected to my site's subdomain. So far, I have successfully connected my website's subdomain (news.mysite.com) to my app using a Heroku domains and my nameserver but my site keeps routing to a https:// version of the herokuapp causing browsers to warn users about the sites certificate.
Can I remove the https routing to my app, or ensure that the browsers ignore the security certificate from Heroku?
CName:
| Host | Points to |
| www | sheltered-plains-7225.herokuapp.com |
| news | news.mysite.com | <-- Https Errors
If you need SSL and wish to use a custom subdomain then you must purchase a license for the subdomain and Add Endpoint for Heroku.
Heroku's SSL license is a wildcard that will cover all of it's own subdomains under *.herokuapp.com. So sheltered-plains-7225.herokuapp.com is covered but news.mysite.com is not.
If you do not need SSL then you should change your environment.
in /config/environments/production.rb change
config.force_ssl = true
to
config.force_ssl = false
this will route to http instead of https
It would normally be within your app that the redirect to https is done.
Unless you have the Heroku SSL endpoint add-on and an SSL certificate it will always error on https.

Resources