According to this Heroku documentation , we can allow access to the Heroku application hosted at myapp.herokuapp.com
with the custom domain myapp.com
.
I added the following entries to my GoDaddy DNS zone file:
A (Host) Host Points To TTL -------------------------------------------------- @ 50.63.202.1 1/2 Hour CName (Alias) Host Points To TTL -------------------------------------------------- email email.secureserver.net 1/2 Hour ftp @ 1/2 Hour www myapp.herokuapp.com 1/2 Hour
Typically, entry A points to the server. In this case, Heroku does not provide an IP address for its cloud applications, and CNAME seems to be enough.
Going to www.myapp.com
or myapp.com
redirects to https://myapp.herokuapp.com
. However, switching to http://www.myapp.com/blog/post/1
(any address, not the home page) will remain with the domain www.myapp.com
, and clicking links will be OK. myapp.herokuapp.com
you click on the link to the home page, we will be redirected to myapp.herokuapp.com
.
How to configure it so that the visitor does not see the herokuapp.com address if you do not visit it with this address?
Output of heroku --tail --app myapp logs:
2016-03-11T01:13:49.756887+00:00 heroku[router]: at=info method=GET path="/" host=vast-hamlet-33090.herokuapp.com request_id=6177aa6c-dc5f-4de5-a1c6-1ff8b1194849 fwd="24.17.117.236" dyno=web.1 connect=1ms service=24ms status=304 bytes=181 2016-03-11T01:13:49.760014+00:00 app[web.1]: 24.17.117.236 - - [11/Mar/2016:01:13:49 +0000] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"
It looks like the application never receives a request from www.myapp.com, but only myapp.herokuapp.com.
The output of heroku -a myapp domains:
source share