Better way to get request object and use ip instead of REMOTE_ADDR