How to configure DNS for Rails 4 multi-tenant app on postgreSQL schemas
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 subdomain.domain.com/users/sign_in 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 subdomain.domain.com/users/sign_in but can reach subdomain's login page with subdomain.XXX.domain.com/users/sign_in 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 184.108.40.206
A record, * to 220.127.116.11
My zone file is as follows:
myapp.com. IN SOA ns1.digitalocean.com. hostmaster.myapp.com. 1425577279 10800 3600 604800 1800
myapp.com. 1800 IN NS ns1.digitalocean.com.
myapp.com. 1800 IN NS ns2.digitalocean.com.
myapp.com. 1800 IN NS ns3.digitalocean.com.
myapp.com. 1800 IN A 18.104.22.168
*.myapp.com. 1800 IN A 22.214.171.124