What to do if you just want basic http authentication for the whole site? As of today there's no such thing built in. (If this changes, let me know...)
If you're serving your Play pages through Apache as reverse proxy, you're lucky.
Going through a reverse proxy is a good idea anyway:
- You get the option for load balancing and failover: run multiple instances.
- Run multiple Play sites on the same machine, on whatever port number, and expose them all on port 80 to the outside.
I'm running my Play app in a virtual machine (192.168.56.100) on standard port 9000. The connection timeout is there so that long running tasks are not aborted by the proxy.
Create the password file as usual:
cd /etc/apache2/sites-available/
htpasswd -c .htpasswd-mysite newuser
And then refresh Apache, and you're done:
service apache2 reload
No comments:
Post a Comment