Setting Google domains to use https

Randy Tang picture Randy Tang · Mar 26, 2018 · Viewed 10.1k times · Source

I purchased a domain (say, example.com) from Google and my Django application (say, mysite.herokuapp.com) runs on Heroku. The CNAME is set on Google to forward the http requests to the Django applicaiton on Heroku. Forwarding requests from http://mysite.example.com to mysite.herokuapp.com works just fine.

Recently, I need to introduce progressive-web-application to my application and it requires the https protocol, instead of http, that is, the URL now has to be https://mysite.example.com and it doesn't work for Google domains. I tried https://mysite.herokuapp.com and it works fine, which means Heroku already supports https. However, I tried (and also googled) for a long time without finding a solution.

So how do I set the Google domain to use https protocol?

Answer

Bernhard picture Bernhard · Apr 5, 2018

The DNS answer from Google cannot contain the port or protocol (http vs. https), it just contains the hostname.

You need to add a redirect from http to https in the Heroku django app, see e.g. here for more instructions.