Mojolicious Plugin to get a client's IP address from X-Forwarded-For
Perl
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/Mojolicious/Plugin
t
.gitignore
.travis.yml
Build.PL
Changes
LICENSE
META.json
README.md
cpanfile
minil.toml

README.md

Build Status

NAME

Mojolicious::Plugin::ClientIP - Get client's IP address from X-Forwarded-For

SYNOPSIS

use Mojolicious::Lite;

plugin 'ClientIP';

get '/' => sub {
    my $c = shift;
    $c->render(text => $c->client_ip);
};

app->start;

DESCRIPTION

Mojolicious::Plugin::ClientIP is a Mojolicious plugin to get an IP address looks like client, not proxy, from X-Forwarded-For header.

METHODS

client_ip

Find a client IP address from X-Forwarded-For. Private network addresses in XFF are ignored by default. If the good IP address is not found, it returns Mojo::Transaction#remote_address.

OPTIONS

ignore

Specify IP list to be ignored with ArrayRef.

plugin 'ClientIP', ignore => [qw(192.0.2.1 192.0.2.16/28)];

LICENSE

Copyright (C) Six Apart Ltd. sixapart@cpan.org

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

ziguzagu ziguzagu@cpan.org