What's the right way to retrieve the client's IP address? 

Create helper:

    $self->renderer->add_helper(ip => sub {
      my $self = shift;
      my $for  = $self->req->headers->header('X-Forwarded-For');
      return $for && $for !~ /unknown/i ? $for : undef || 
$self->req->headers->header('X-Real-IP') || $self->tx->{remote_address};
    });

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to