I have a multi-tenant app on Heroku where each tenant has a portal (micro-site) that lives in a sub-directory (e.g. http://www.example.com/portals/foo-bar). My domain is hosted by GoDaddy and I want each tenant to be able to create a subdomain on their site for their portal to live in. I'm trying to create my own subdomain to test the process, but I can't figure out how to link a subdomain to a subdirectory on GoDaddy. I would presume that the process is pretty similar across domain registrars, but I'm not sure.

If I try creating an A record or a CNAME, it will only accept an IP address. I could create a simple redirect, but I want my user to stay on the subdomain as they interact with the portal, rather than simply be redirected from http://portal.foo-bar.com to http://www.example.com/portals/foo-bar.

Is this possible, and if so, how?

  • Address records point to IP addresses. It is not possible to do what you want in the DNS alone. Use your web server for this. – Michael Hampton Jul 30 '15 at 18:15
  • we miss the detail of what web server you use, urlrewrite would do what you need in iis – yagmoth555 Jul 30 '15 at 18:17
  • My site uses WEBrick (will be migrating to Unicorn or Puma soon), but my client's will be the ones setting up subdomains on their site to house their portal, and I don't know what servers they run. I have just a few clients right now, but that could soon increase to a few dozen. – Daniel Bonnell Jul 30 '15 at 19:23

I think you would need to create subdomain in GoDaddy control panel for each domain and specify subdirectory for this subdomain and you will also need CNAME record in your DNS.

|improve this answer|||||
  • This meets most of my requirements so I checked it as the answer. The only problem I have with this solution is that using the redirect with masking option limits me to using a static page title for every page on a portal. I wonder if there is a way around that somehow using Javascript. I also need to allow cross-origin framing, although I'm less concerned with that, since I can limit it to certain known URLs to mitigate any security concerns. – Daniel Bonnell Jul 30 '15 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.