How can you get a user's IP in PlayFramework2 ?
nginx, playframework-2.0
Solution
It's now possible with Play 2.0.2+ : RequestHeader.remoteAddress()
Java :
String ip = request().remoteAddress();
Scala :
Action { request =>
val ip = request.remoteAddress()
}
Problem
For security reasons, sometimes it is needed to block users by IP. In my case, I would like to manage the IP blacklist in a (SQL) database. I guess I can handle the filter part based on Action Composition but for that I need the user's IP. So, how can I get the user's IP? PS : The application is running behind a nginx proxy.