How do I find out if my request was made over HTTP or HTTPS in Play 2.0?
Is there a way to find out from the request?
def myControllerMethod = Action { request =>
// this is where I would like to know
}
Play 1.X had a solution, it was request.secure. Please let me know if you know.
Play! Framework 2.0 doesn’t currently support HTTPS (the master branch does seem to have support, but that will probably be rolled into Play 2.1). A great way to deploy Play! (in general, and also to support HTTPS) is to use a front proxy web server, like nginx or lighttpd.
Here’s a guide on setting up a front-end web server. Then, you can just add a special header for HTTPS requests. Additionally, you’ll be able to deploy several Play! applications at once, and use the front-end web server to load balance and fail over automatically.