As soon as you need multi tenancy support for your application, chances are high that every tenant will also run on its own host, such as http://firsttenant.yourapp.com and http://secondtenant.yourapp.com. For example, this way you can customize the application a little bit and the user who wants to log in does not have to supply any tenant information.
The source code of the example is available at examples/chapter7/virtualhost
.
Put the following in your routes
file:
GET {tenant}.mysoftware.com/ Application.index
From then on you can use the client variable in your controller methods:
public static void index(String tenant) { renderText(tenant); }
You can even configure a different handling of CDN-based content for development and production right, use mode in your routes file. Write the following in your routes
file:
#{if play.Play.mode.isDev()} GET /public/ staticDir:public #{/} #{else} GET assets.myapp.com/ staticDir...