Reputation: 728
I am using Play 2.0 framework, which I know use the Netty HTTP server by default. How can you set virtual host so that www.domain1.com redirect to www.maindomain.com/sites/domain1.com/?
Since Play 2.0, the routing is much more restreint and nobody seems to answer this question anywhere.
In Play 1.0, it was possible to do it inside the route file but now it is impossible :(
I am also using the jar production files (with dist), just to be clear, and I know Netty is there but I have no clue how to add virtual host.
Upvotes: 3
Views: 1489
Reputation: 728
It seems like I've found the answer of my own question. Having a lot of PHP background and no Web application background, I wasn't understanding correctly the principle of front-end and back-end with Play 2.0.
What I need to do is keep Play running on 9000 and have a front-end Apache server (a different one!). Then, virtual hosts are as easy as before. I don't need to touch to the Netty HTTP server.
<VirtualHost *:80>
ProxyPreserveHost On
ServerName www.domain1.com
ProxyPass /excluded !
ProxyPass / http://127.0.0.1:9000/sites/domain1.com/
ProxyPassReverse / http://127.0.0.1:9000/sites/domain1.com/
</VirtualHost>
You can get more infos at http://www.playframework.org/documentation/2.0.4/HTTPServer
Upvotes: 6