heroku / platform-api

Ruby HTTP client for the Heroku API
MIT License
214 stars 85 forks source link

Unable to create custom DNS + CNAME #55

Closed kuldeepaggarwal closed 7 years ago

kuldeepaggarwal commented 7 years ago

I am trying to create a custom DNS + CNAMe via platform-api gem but still not able to set custom CNAME, e.g.

heroku = PlatformAPI.connect_oauth('API-key')
heroku.domain.create( 'brandnew-advertiser-fe-staging', {"hostname" => 'mediacom.brandnew.in', "kind" => "custom", "cname" => "brandnew-advertiser-fe-staging.herokuapp.com"})

# => {"app"=>{"id"=>"<APP_ID>", "name"=>"brandnew-advertiser-fe-staging"}, "cname"=>"mediacom.brandnew.in.herokudns.com", "created_at"=>"2017-01-13T10:02:40Z", "hostname"=>"mediacom.brandnew.in", "id"=>"<ID>", "kind"=>"custom", "status"=>"pending", "updated_at"=>"2017-01-13T10:02:40Z"}

you can see that cname is not same.

ransombriggs commented 7 years ago

@kuldeepaggarwal cname is a readonly attribute that is set internally by heroku. Sorry that this is not obvious from the platform docs. What you should do is omit cname from the post body when you are generating a custom domain and let heroku generate a cname for you.

When you created your custom domain heroku set up mediacom.brandnew.in.herokudns.com for you to point your DNS CNAME record at. Once DNS is configured properly, this will allow mediacom.brandnew.in to be served by heroku infrastructure.

geemus commented 7 years ago

This appear to have a clear answer now, closing. Please let us know if you have further questions.

ayushgangrade11 commented 7 years ago

Hey Ransombriggs & geemus , I am also stuck on a similar problem where my python app hosted on heroku has a default heroku dns address and I am saving the same entry in NS and keeping CNAME as empty. I am unable to make requests to my domain.

geemus commented 7 years ago

@ayushgangrade11 sorry to hear you are still having issues. If you could file a support ticket on heroku, they should better be able to help you with that specific setup.