Cname to multi-level heroku subdomain

user123424234 asked:

I’m trying to create a cname that points from my custom domain (s.mydomain.com) to a multilevel subdomain hosted on heroku (me.myapp.herokuapp.com).

I’ve created the Cname s.mydomain.com with the value me.myapp.herokuapp.com. When I go to s.mydomain.com it does not route to me.myapp.herokuapp.com, instead I get:

method=GET path=/ host=s.mydomain.com dyno=web.1 queue=0 wait=0ms connect=4ms service=18ms status=404

It’s possible I’m not fully understanding how this Cname should be setup. My desired outcome is for s.mydomain.com to act as if it were at me.myapp.herokuapp.com.

My answer:


Follow along the documentation carefully. There are exactly two things you need to do:

  1. Tell Heroku about your subdomain.

    heroku domains:add s.mydomain.com
    
  2. Set the CNAME record in your DNS.

    s       IN      CNAME   mature-infant-1234.herokuapp.com.
    

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.