How to configure DNS for Rails 4 multi-tenant app on postgreSQL schemas

March 5, 2015 911 views
PostgreSQL Nginx Ruby Ruby on Rails DigitalOcean DNS Ubuntu

I recently deployed my code successfully to my droplet by following the available tutorials on the site. Visiting the root page seems to be working correctly, however, after I create a new account with a new subdomain, I am unable to visit the subdomain's login page at with rails complaining the route does not exist.

Surprisingly, I am able to get to the correct subdomain's login page by adding another level of subdomain in the address for example:

I cannot reach subdomain's login page from but can reach subdomain's login page with where XXX is any character. My app seems to recognize the subdomain name only after i put in the XXX value.

My DNS settings are:

A record, @ to
A record, * to

My zone file is as follows:

$TTL 1800 IN SOA 1425577279 10800 3600 604800 1800 1800 IN NS 1800 IN NS 1800 IN NS 1800 IN A
* 1800 IN A

Be the first one to answer this question.