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 22.214.171.124
A record, * to 126.96.36.199
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 188.8.131.52
*.myapp.com. 1800 IN A 184.108.40.206