Subdomain Multi-tenant App


Hi there. Currently I am running a fairly complicated SaaS (Rails only) project and is due to upgrade to something bigger on front-end (+ API access) and since I have some experience with Ember it makes sense to go for it. I am at planning stage to get my head around how I would achieve functionality without many regressions for existing clients. Currently my app hosts multiple clients (using Apartment gem on Rails side) where each client gets its own subdomain, eg.:

While Sign Up is handled via, as you can imagine runs on its own server (marketing stuff), so DNS config is literally set to redirect any URL with wildcard subdomain to Rails App, which handles log in functionality (if client exists - show login page, otherwise redirect to find your account/sign up page). So my question is how would this structure look with Ember on top of all this? In theory I am thinking of any URL with Subdomain would be redirected to Ember app (starting point signup/app/ for non-existing accounts), while Ember App itself would talk to rails api via Would this work or it has some obvious stupid mistake which I have not thought about yet? Thank you.


I would just have the rails app serve the Ember app’s index.html file from redis/s3/disk.

Check out how this example works:

In development, you can just grab the index.html file from the ember app’s dist folder or just make a HTTP request to the ember-cli server.

You will have to shim a few things like the livereload path and csrf tokens, but it’s a pretty trivial string replacement. Things like: String.replace("/ember-cli-live-reload.js", "http://localhost:4200/ember-cli-live-reload.js")

Let me know if that helps clear things up for you.

Cheers, Ben