I am building my first SAAS app and I am new to Ruby on Rails. I want to build the app so that the promotional site (www.myapp.com, the site where the users sign up) and the main app that the users will use (each account will have it's own subdomain) are separate apps so that I don't have to push updates to both when I only want to make changes to the other (also just so I can have a clean separation). The problem is, you can't host one app using wildcard subdomains and another app at a specific subdomain (www). Is there a clean way to separate the two?
I a开发者_StackOverflow社区m wondering how other people have done this. Am I going to too much work to separate the two? Is there a way that I can I create some sort of router that routes requests from "reserved subdomains" (www, blog, help, etc) to the promotional app and all other requests to the main app?
I would create a subdomain route for 'www' in your rails app whichs points to a separate rack app(another Rails or Sinatra app etc) which would be your promo site.
Watch these two railscasts, which should give you the ammo to accomplish this.
http://railscasts.com/episodes/221-subdomains-in-rails-3
http://railscasts.com/episodes/222-rack-in-rails-3
Hope this helps.
You said "The problem is, you can't host one app using wildcard subdomains and another app at a specific subdomain (www)"
But you can.
If you have an A record of www
, and then a * record
pointing to your app, it will work perfectly fine.
精彩评论