TL;DR: I want my custom domain to be shown in the address bar, not the CNAME.
I have an app hosted on Heroku at try-elixir-phoenix.herokuapp.com.
I bought the domain from Namecheap, and configured the CNAME entry there:
www.tryelixir.online CNAME try-elixir-phoenix.herokuapp.com.
I also configured the custom domains in heroku:
$ heroku domains
=== try-elixir-phoenix Heroku Domain
try-elixir-phoenix.herokuapp.com
=== try-elixir-phoenix Custom Domains
Domain Name DNS Target
──────────────────── ────────────────────────────────
tryelixir.online try-elixir-phoenix.herokuapp.com
www.tryelixir.online try-elixir-phoenix.herokuapp.com
But if I curl my custom domain, I get a 301 redirect:
$ curl --head http://www.tryelixir.online
HTTP/1.1 301 Moved Permanently
Connection: keep-alive
Server: Cowboy
Date: Thu, 25 Feb 2016 15:11:01 GMT
Content-Length: 0
Cache-Control: max-age=0, private, must-revalidate
Location: https://try-elixir-phoenix.herokuapp.com/
Via: 1.1 vegur
This also means that the user sees the herokuapp.com
URL, instead of my custom one.
The Heroku docs say that:
Your app’s Heroku Domain will always remain active, even if you’ve set up a custom domain. If you want users to use the custom domain exclusively, your app should send HTTP status 301 Moved Permanently to tell web browsers to use the custom domain. The Host HTTP request header field will show which domain the user is trying to access; send a redirect if that field is example.herokuapp.com.
Does the above apply to me?