Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up HTTPS DNS with Namecheap and Heroku

I know there have been very similar questions asked but both companies changed over time and it's been hard to get a full working solution.

I'd like to have a naked subdomain (mysite.io) but if I have to have www.mysite.io, that's fine too.

So on the heroku dashboard I have :

DOMAIN NAME : mysite.io  DNS TARGET : mysite.io.herokudns.com
DOMAIN NAME : www.mysite.io  DNS TARGET www.mysite.io.herokudns.com

I know I should probably only have one of those active but I'm not sure which...

Then, on the NameCheap dashboard, I have :

EDIT: I have read what seemed like a good answer, here's what I changed, awaiting to see if it's gonna work.

CNAME Record  - www - www.mysite.io.herokudns.com
CNAME Record - @ - mysite.io.herokudns.com

And no redirect

I will update if it works

UPDATE :

Using two CNAME records indeed worked fine, except that users can still connect in HTTP and not be redirected to HTTPS. I probably need to add a redirect for that.

like image 806
Storm Avatar asked Apr 13 '17 00:04

Storm


1 Answers

If anyone is still having problems and your website opens without HTTPS. There is a line of code in rails applications which you should uncomment. Go to config/environments/production.rb In this file you will find a commented line "config.force_ssl = true". Uncomment this line and your application will always open up with https

like image 188
Domantas G Avatar answered Oct 18 '22 06:10

Domantas G