Scala Play Framework getting user IP

I have seen this before, but I have not been able to use these answers to get the user's IP address.

in PHP it will be as follows:

$_SERVER['REMOTE_ADDR']; 
+6
source share
1 answer

If you need to access this information as part of an action:

 Action { request => val address = request.remoteAddress; ... } 

If you need access to another location, note that you can use implicit:

 Action { implicit request => ... } myMethod(implicit request: Request) { ... } 

And you can always return to the simple passage of the request.

+6
source

Source: https://habr.com/ru/post/926455/


All Articles