Play Framework: How to Host multiple sites using same Play instance (aka virtualhosts)
Lately I have coded few small services/sites using play framework and I found the need to co-host these multiple sites on a single physcial server.
Lately I have coded few small services/sites using play framework and I found the need to co-host these multiple sites on a single physcial server.
Few days back while deploying a play application on a ubuntu server, I got following error (this application was running fine in dev and prod mode on a mac)
```scala
play.api.UnexpectedException: Unexpected exception[MalformedInputException: Input length = 1]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:276)
at play.api.http....
Manytimes we need to host multiple websites/applications on a single host - e.g., say a wordpress (php) blog with a play app or 2 play apps on a single host. One of the simplest way to achieve this is to use apache as a frontend proxy routing traffic back to the right application based on domain name.
Post 2.5.x release, older approach of having Global objects to access configuration parameters available in application.conf is no longer recommended. Instead, it is advised now to use dependency injection to access these.