1

My rails app uses subdomains to handle requests from different user roles. The app has two user roles, Role1 and Role2. I've been using vcap.me:3000 to test this locally. For example: the request "role1.vcap.me:3000" is processed differently than "role2.vcap.me:3000" because I want Role1 users to see a page that's different to that of Role2 users. The above mentioned works perfectly locally.

My problem is that in production, this is not working: I purchased a domain from GoDaddy (example: domain.com) and I'm deploying to Heroku (example: myapp.herokuapp.com)

I was able to point www.domain.com to myapp.herokuapp.com in GoDaddy by adding a CNAME record that points 'www' to myapp.herokuapp.com. So if I send a request to www.domain.com, I'm directed to my app. However, I have not been able to make the subdomains work. Example: this request role1.domain.com does not direct me to my app.

I followed Heroku's docs on Custom Domain Names for Apps and I tried to find answers in stackoverflow and other sites (links below) that would help me figure out my problem but I couldn't get any of their solutions to work.

https://stackoverflow.com/questions/33086225/heroku-godaddy-ssl-wildcard-setup

Rails, Heroku and Subdomains. Is my special case scenario feasible?

https://forum.upcase.com/t/subdomain-not-working-in-heroku-and-namecheap/5096

Some posts are suggesting that I need to use something like DNSimple (which I never used before). Do I need to use a service like DNSimple? How should I set things up in that case? Or, can I set things up properly just with GoDaddy? What should I do in that case?

Any guidance would be greatly appreciated since I have little experience with DNS. Thanks in advance!

Community
  • 1
  • 1
Guillo S
  • 21
  • 1
  • 5
  • What Heroku tier are you on? I'm not entirely sure, but if you're using the free tier, I don't think subdomains are supported. – MarsAtomic Oct 15 '15 at 19:33
  • I'm on the free tier, but I plan to upgrade once I get the app up and running. Could you refer me to the source of your information? Thanks – Guillo S Oct 16 '15 at 00:27
  • Search through SO for keywords "rails subdomain heroku." I seem to recall reading an answer indicating that the creation of subdomains for free tier apps was "no longer possible on heroku" or words to that effect, but I couldn't find the QA just now. – MarsAtomic Oct 16 '15 at 01:58

1 Answers1

1

I was able to solve my problem! I didn't have to use a service like DNSimple and could make it work just through GoDaddy. I added a CNAME record *.domain.com that points to myapp.herokuapp.com and added the domain *.domain.com in heroku by doing: heroku domains:add *.domain.com

Guillo S
  • 21
  • 1
  • 5