=head1 NAME

Mojolicious::Plugin::RemoteAddr - an easy way of getting remote ip address


  # Mojolicious

  # In controller
  my $ip = $self->remote_addr;


L<Mojolicious::Plugin::RemoteAddr> adds simple helper "remote_addr" which returns an ip address of a remote host, It tries getting remote ip in different ways.
Firstly, it takes 'X-Real-IP' header. Secondly, it takes 'X-Forwarded-For' header. If they are empty it takes the ip from current request transaction.

=head1 CONFIG

=head2 order

Lookup order. Default is ['x-real-ip', 'x-forwarded-for', 'tx']

If you do not have reverse proxy then set order to ['tx'] to avoid ip-address spoofing.

Supported places:

=over 4

=item 'x-real-ip'

'X-Real-IP' request header

=item 'x-forwarded-for'

'X-Forwarded-For' request header

=item 'tx'

current request transaction


=head1 HELPERS

=head2 remote_addr

Returns remote IP address

=head1 AUTHOR

Viktor Turskyi <koorchik@cpan.org>

=head1 BUGS

Please report any bugs or feature requests to Github L<https://github.com/koorchik/Mojolicious-Plugin-RemoteAddr>

=head1 SEE ALSO

L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.