Result:
found 109 distributions and 256 files matching your query ! ( run in 0.457 )


Mojolicious-Plugin-PlackMiddleware

 view release on metacpan or  search on metacpan

xt/compat/lite_app.t  view on Meta::CPAN

689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# Root with format
$t->get_ok('/.html')->status_is(200)
  ->header_is(Server => 'Mojolicious (Perl)')
  ->content_is("/root.html\n/root.html\n/root.html\n/root.html\n/root.html\n");
 
# Reverse proxy with "X-Forwarded-For"
{
  local $ENV{MOJO_REVERSE_PROXY} = 1;
  $t->ua->server->restart;
  $t->get_ok('/0' => {'X-Forwarded-For' => '192.0.2.2, 192.0.2.1'})
    ->status_is(200)->header_unlike('X-Original' => qr/192\.0\.2\.1/)
    ->content_like(qr!http://127\.0\.0\.1:\d+/0-192\.0\.2\.1-0$!);
}
 
# Reverse proxy with "X-Forwarded-Proto"

xt/compat/lite_app.t  view on Meta::CPAN

707
708
709
710
711
712
713
714
715
716
717
718
719
  $t->get_ok('/0' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
    ->content_like(qr!^https://127\.0\.0\.1:\d+/0-!)->content_like(qr/-0$/)
    ->content_unlike(qr!-192\.0\.2\.1-0$!);
}
 
# "X-Forwarded-For"
$t->ua->server->restart;
$t->get_ok('/0' => {'X-Forwarded-For' => '192.0.2.2, 192.0.2.1'})
  ->status_is(200)->content_like(qr!^http://127\.0\.0\.1:\d+/0-!)
  ->content_like(qr/-0$/)->content_unlike(qr!-192\.0\.2\.1-0$!);
 
# "X-Forwarded-Proto"
$t->get_ok('/0' => {'X-Forwarded-Proto' => 'https'})->status_is(200)

 view all matches for this distribution


Mojolicious-Plugin-RemoteAddr

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/RemoteAddr.pm  view on Meta::CPAN

14
15
16
17
18
19
20
21
22
23
24
foreach my $place ( @{ $conf->{order} } ) {
    if ( $place eq 'x-real-ip' ) {
        my $ip = $c->req->headers->header('X-Real-IP');
        return $ip if $ip;
    } elsif ( $place eq 'x-forwarded-for' ) {
        my $ip = $c->req->headers->header('X-Forwarded-For');
        return $ip if $ip;
    } elsif ( $place eq 'tx' ) {
        my $ip = $c->tx->remote_address;
        return $ip if $ip;
    }

lib/Mojolicious/Plugin/RemoteAddr.pm  view on Meta::CPAN

43
44
45
46
47
48
49
50
51
52
  my $ip = $self->remote_addr;
 
=head1 DESCRIPTION
 
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

lib/Mojolicious/Plugin/RemoteAddr.pm  view on Meta::CPAN

63
64
65
66
67
68
69
70
71
72
'X-Real-IP' request header
 
=item 'x-forwarded-for'
 
'X-Forwarded-For' request header
 
=item 'tx'
 
current request transaction

 view all matches for this distribution


Mojolicious-Plugin-SecureOnly

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/SecureOnly.pm  view on Meta::CPAN

32
33
34
35
36
37
38
39
40
41
42
  });
}
 
sub detect_proxy {
  my $c = shift;
  return $c->tx->req->headers->header('X-Forwarded-For') || $c->tx->req->headers->header('X-Forwarded-Proto')
}
 
1;
 
__END__

 view all matches for this distribution


Mojolicious-Plugin-TrustedProxy

 view release on metacpan or  search on metacpan

t/01_ip_headers.t  view on Meta::CPAN

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  ->status_is(200)->content_is('1.1.1.1', sprintf(
    '[%s.%d] Assert from header X-Real-IP => 1.1.1.1 that tx->remote_address == 1.1.1.1',
    $TEST, $tid)
  );
 
# Header: [default] X-Forwarded-For (single)
$tid++;
$tc += 3;
$t->get_ok('/ip' => {'X-Forwarded-For' => '1.1.1.1'})
  ->status_is(200)->content_is('1.1.1.1', sprintf(
    '[%s.%d] Assert from header X-Forwarded-For => 1.1.1.1 that tx->remote_address == 1.1.1.1',
    $TEST, $tid)
  );
 
# Header: [default] X-Forwarded-For (multiple)
$tid++;
$tc += 3;
$t->get_ok('/ip' => {'X-Forwarded-For' => '1.1.1.1 , 2.2.2.2,3.3.3.3'})
  ->status_is(200)->content_is('1.1.1.1', sprintf(
    '[%s.%d] Assert from header X-Forwarded-For => "1.1.1.1 , 2.2.2.2,3.3.3.3" that tx->remote_address == 1.1.1.1',
    $TEST, $tid)
  );
 
# Check IPv6 support
$tid++;
$tc += 3;
$t->get_ok('/ip' => {'X-Forwarded-For' => 'fc01:c0ff:ee::'})
  ->status_is(200)->content_is('fc01:c0ff:ee::', sprintf(
    '[%s.%d] Assert from header X-Forwarded-For => fc01:c0ff:ee:: that tx->remote_address == fc01:c0ff:ee::',
    $TEST, $tid)
  );
 
# Check bad IP value
$tid++;
$tc += 3;
$t->get_ok('/ip' => {'X-Forwarded-For' => '123.456.789.000'})
  ->status_is(200)->content_is('127.0.0.1', sprintf(
    '[%s.%d] Assert from header X-Forwarded-For => 123.456.789.000 that tx->remote_address == 127.0.0.1',
    $TEST, $tid)
  );
 
# Check remote_proxy_address
$tid++;

 view all matches for this distribution


Net-API-Telegram

 view release on metacpan or  search on metacpan

lib/Net/API/Telegram.pm  view on Meta::CPAN

795
796
797
798
799
800
801
802
803
804
805
806
807
my $req;
my $ip_check = 0;
REQUEST: while( $req = $client->get_request )
{
        my $remote_addr;
        if( $req->header( 'X-Forwarded-For' ) )
        {
                $remote_addr = Net::IP->new( $req->header( 'X-Forwarded-For' ) );
        }
        else
        {
                $remote_addr = Net::IP->new( Socket::inet_ntoa( $client->peeraddr ) );
        }

 view all matches for this distribution


Net-FullAuto

 view release on metacpan or  search on metacpan

lib/Net/FullAuto/ISets/Local/EmailServer_is.pm  view on Meta::CPAN

1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
'%NL%        }'.
'%NL%'.
'%NL%        location /rspamd {'.
'%NL%            proxy_pass http://127.0.0.1:11334/;'.
'%NL%            proxy_set_header Host $host;'.
'%NL%            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;'.
'%NL%        }'.
'%NL%'.
'%NL%        location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {'.
'%NL%            deny all;'.
'%NL%        }'.

 view all matches for this distribution


Net-WURFL-ScientiaMobile

 view release on metacpan or  search on metacpan

lib/Net/WURFL/ScientiaMobile.pm  view on Meta::CPAN

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Add HTTP Headers to pending request
$headers{'User-Agent'} = $self->_user_agent;
$headers{'X-Cloud-Client'} = __PACKAGE__ . " $VERSION";
 
# Add X-Forwarded-For
{
    my $ip = $self->_http_request->{REMOTE_ADDR};
    my $fwd = $self->_http_request->{HTTP_X_FORWARDED_FOR};
    if ($ip) {
        $headers{'X-Forwarded-For'} = "$ip" . ($fwd ? ", $fwd" : "");
    }
}
 
# We use 'X-Accept' so it doesn't stomp on our deflate/gzip header
$headers{'X-Accept'} = $self->_http_request->{HTTP_ACCEPT} if $self->_http_request->{HTTP_ACCEPT};

 view all matches for this distribution


Net-WebSocket-EVx

 view release on metacpan or  search on metacpan

lib/Net/WebSocket/EVx.pod  view on Meta::CPAN

71
72
73
74
75
76
77
78
79
80
81
  listen 127.0.0.1:5000;
  location / {
    proxy_pass http://app;
    proxy_ignore_client_abort on;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $http_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }
}

 view all matches for this distribution


Nginx-Perl

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

757
758
759
760
761
762
763
764
765
766
Changes with nginx 1.5.2                                         02 Jul 2013
 
    *) Feature: now several "error_log" directives can be used.
 
    *) Bugfix: the $r->header_in() embedded perl method did not return value
       of the "Cookie" and "X-Forwarded-For" request header lines; the bug
       had appeared in 1.3.14.
 
    *) Bugfix: in the ngx_http_spdy_module.
       Thanks to Jim Radford.

CHANGES  view on Meta::CPAN

885
886
887
888
889
890
891
892
893
894
*) Bugfix: new sessions were not always stored if the "ssl_session_cache
   shared" directive was used and there was no free space in shared
   memory.
   Thanks to Piotr Sikora.
 
*) Bugfix: multiple X-Forwarded-For headers were handled incorrectly.
   Thanks to Neal Poole for sponsoring this work.
 
*) Bugfix: in the ngx_http_mp4_module.
   Thanks to Gernot Vormayr.

CHANGES  view on Meta::CPAN

6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
   with the "proxy_set_header X-Real-IP $remote_addr" directive.
 
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
   replaced with
   the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
   directive.
 
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
   the "proxy_set_header X-URL http://$host:$server_port$request_uri"
   directive.

 view all matches for this distribution


OpenInteract

 view release on metacpan or  search on metacpan

OpenInteract/ApacheStartup.pm  view on Meta::CPAN

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use constant DEBUG => 0;
 
$OpenInteract::ApacheStartup::VERSION   = sprintf("%d.%02d", q$Revision: 1.26 $ =~ /(\d+)\.(\d+)/);
 
# Create a handler to put the X-Forwarded-For header into the IP
# address -- thanks Stas! (perl.apache.org/guide/)
 
my $PROXY_SUB = <<'PROXY';
 
  sub OpenInteract::ProxyRemoteAddr ($) {
    my ( $r ) = @_;
    return unless ( ref $r );
    if ( my ( $ip ) = $r->header_in( 'X-Forwarded-For' ) =~ /([^,\s]+)$/ ) {
      $r->connection->remote_ip( $ip );
    }
    return Apache::Constants::OK;
  }
PROXY

 view all matches for this distribution


POE-Component-Server-Bayeux

 view release on metacpan or  search on metacpan

lib/POE/Component/Server/Bayeux.pm  view on Meta::CPAN

537
538
539
540
541
542
543
544
545
546
547
        $content = <$in>;
    }
    close $in;
    $response->content($content);
 
    my $ip = $request->header('X-Forwarded-For') || $request->{connection}{remote_ip};
    $heap->{logger}->info(sprintf 'Serving %s %s %s', $ip, $uri->path, $response->content_type);
}
else {
    $response->code(RC_NOT_FOUND);
    $response->content("Path '".$uri->path."' not found");

lib/POE/Component/Server/Bayeux.pm  view on Meta::CPAN

562
563
564
565
566
567
568
569
570
571
sub handle_cometd {
    my ($kernel, $heap, $request, $response) = @_[KERNEL, HEAP, ARG0, ARG1];
 
    # Deny based upon ClientMaxConnections restrictions
 
    my $ip = $request->header('X-Forwarded-For') || $request->{connection}{remote_ip};
    if (! $ip) {
        $ip = '0.0.0.0';
        $heap->{logger}->error("No IP found for cometd request");
    }

 view all matches for this distribution


POE-XUL

 view release on metacpan or  search on metacpan

lib/POE/Component/XUL.pm  view on Meta::CPAN

967
968
969
970
971
972
973
974
975
976
977
978
local $self->{logging}->{app} = $app;
 
my $conn = $req->connection;
my @log;
push @log, ($conn ? $conn->remote_ip : '0.0.0.0');
if( $log[-1] eq '127.0.0.1' and $req->header( 'X-Forwarded-For' ) ) {
    $log[-1] = $req->header( 'X-Forwarded-For' );
}
# push @log, ($self->{preforked} ? $$ : '-');
push @log, $$, '-';

 view all matches for this distribution


Parse-NetApp-ASUP

 view release on metacpan or  search on metacpan

examples/7.2.3/asup02.txt  view on Meta::CPAN

1
2
3
4
5
6
7
8
From UNKNOWN (HTTP POST) Sat Mar 17 23:53:05 2012 (177682)
Received: from UNKNOWN via NGZXTAAPP02-PRD.CORP.NETAPP.COM (HTTP POST) for spiderX.corp.netapp.com; 17 Mar 2012 23:53:05 PDT
X-Forwarded-For: 160.109.21.1
X-Netapp-asup-version: 2
X-Netapp-asup-content: complete
X-Netapp-asup-subject: System Notification from stmgr01 (WEEKLY_LOG) INFO
X-Netapp-asup-system-id: 0101177530
X-Netapp-asup-os-version: NetApp Release 7.2.3: Thu Jul  5 09:51:46 PDT 2007

 view all matches for this distribution


Paws

 view release on metacpan or  search on metacpan

lib/Paws/ELBv2/SourceIpConditionConfig.pm  view on Meta::CPAN

48
49
50
51
52
53
54
55
56
57
58
59
One or more source IP addresses, in CIDR format. You can use both IPv4
and IPv6 addresses. Wildcards are not supported.
 
If you specify multiple addresses, the condition is satisfied if the
source IP address of the request matches one of the CIDR blocks. This
condition is not satisfied by the addresses in the X-Forwarded-For
header. To search for addresses in the X-Forwarded-For header, use
HttpHeaderConditionConfig.
 
 
 
=head1 SEE ALSO

 view all matches for this distribution


Pcore-Nginx

 view release on metacpan or  search on metacpan

share/tmpl/nginx/host_conf.nginx  view on Meta::CPAN

63
64
65
66
67
68
69
70
71
72
73
proxy_read_timeout 60s;
 
proxy_set_header Host $host;
proxy_set_header X-Accel-Support 1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
# keepalive & websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

 view all matches for this distribution


Pcore-Service-Nginx

 view release on metacpan or  search on metacpan

share/tmpl/nginx/host_conf.nginx  view on Meta::CPAN

59
60
61
62
63
64
65
66
67
68
69
proxy_read_timeout 60s;
 
proxy_set_header Host $host;
proxy_set_header X-Accel-Support 1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
# keepalive & websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

 view all matches for this distribution


Pcore

 view release on metacpan or  search on metacpan

share/tmpl/nginx/vhost-load-balancer.nginx  view on Meta::CPAN

24
25
26
27
28
29
30
31
32
33
34
proxy_read_timeout 60s;
 
proxy_set_header Host $host;
proxy_set_header X-Accel-Support 1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
# keepalive & websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

 view all matches for this distribution


Perlbal-Plugin-ForwardedFor

 view release on metacpan or  search on metacpan

lib/Perlbal/Plugin/ForwardedFor.pm  view on Meta::CPAN

34
35
36
37
38
39
40
41
42
43
44
}
 
sub rewrite_header {
    my ( $svc, $target_header ) = @_;
    my $headers     = $svc->{'req_headers'};
    my $header_name = 'X-Forwarded-For';
    my $forwarded   = $headers->header($header_name);
    my $DELIMITER   = q{, };
    my $EMPTY       = q{};
 
    my @ips = split /$DELIMITER/, $forwarded;

lib/Perlbal/Plugin/ForwardedFor.pm  view on Meta::CPAN

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
__END__
 
=head1 NAME
 
Perlbal::Plugin::ForwardedFor - Rename the X-Forwarded-For header in Perlbal
 
=head1 VERSION
 
Version 0.02
 
=head1 SYNOPSIS
 
This plugin changes the header Perlbal will use to delcare itself as a proxy.
 
Usually Perlbal will - perl RFC - add itself to X-Forwarded-For, but this
plugins allows you to change that to any header you want, so you could differ
Perlbal from other possible proxies the user might have.
 
In your Perlbal configuration:

lib/Perlbal/Plugin/ForwardedFor.pm  view on Meta::CPAN

98
99
100
101
102
103
104
105
106
107
108
=head2 rewrite_header
 
The function that is called as the callback.
 
Rewrites the I<X-Forwarded-For> to whatever header name you specified in the
configuration file.
 
=head1 AUTHOR
 
Sawyer X, C<< <xsawyerx at cpan.org> >>

 view all matches for this distribution


Perlbal

 view release on metacpan or  search on metacpan

lib/Perlbal/BackendHTTP.pm  view on Meta::CPAN

271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
if ($svc->trusted_ip($client_ip)) {
    # yes, we trust our upstream, so just append our client's IP
    # to the existing list of forwarded IPs, if we're a blind proxy
    # then don't append our IP to the end of the list.
    unless ($svc->{blind_proxy}) {
        my @ips = split /,\s*/, ($hds->header("X-Forwarded-For") || '');
        $hds->header("X-Forwarded-For", join ", ", @ips, $client_ip);
    }
} else {
    # no, don't trust upstream (untrusted client), so remove all their
    # forwarding headers and tag their IP as the x-forwarded-for
    $hds->header("X-Forwarded-For", $client_ip);
    $hds->header("X-Host", undef);
    $hds->header("X-Forwarded-Host", undef);
}
 
$self->tcp_cork(1);

 view all matches for this distribution


Plack-App-Prerender

 view release on metacpan or  search on metacpan

lib/Plack/App/Prerender.pm  view on Meta::CPAN

43
44
45
46
47
48
49
50
51
52
53
unless ($self->request) {
    $self->request(
        {
            'User-Agent' => 'X-Forwarded-User-Agent',
            ( map { $_ => $_ } qw/
              X-Forwarded-For
              X-Forwarded-Host
              X-Forwarded-Port
              X-Forwarded-Proto
              /
            ),

lib/Plack/App/Prerender.pm  view on Meta::CPAN

279
280
281
282
283
284
285
286
287
288
It will default to the following headers:
 
=over
 
=item C<X-Forwarded-For>
 
=item C<X-Forwarded-Host>
 
=item C<X-Forwarded-Port>

 view all matches for this distribution


Plack-App-Proxy-WebSocket

 view release on metacpan or  search on metacpan

lib/Plack/App/Proxy/WebSocket.pm  view on Meta::CPAN

119
120
121
122
123
124
125
126
127
128
129
my $headers = $self->SUPER::build_headers_from_env($env, $req);
 
# if x-forwarded-for already existed, append the remote address; the super
# method fails to maintain a list of multiple proxies
if (my $forwarded_for = $env->{HTTP_X_FORWARDED_FOR}) {
    $headers->{'X-Forwarded-For'} = "$forwarded_for, $env->{REMOTE_ADDR}";
}
 
# the super method depends on the user agent to add the host header if it
# is missing, so set the host if it needs to be set
if ($uri && !$headers->{'Host'}) {

lib/Plack/App/Proxy/WebSocket.pm  view on Meta::CPAN

213
214
215
216
217
218
219
220
221
222
223
=head1 METHODS
 
=head2 build_headers_from_env
 
Supplement the headers-building logic from L<Plack::App::Proxy> to maintain
the complete list of proxies in C<X-Forwarded-For> and to set the following
headers if they are not already set: C<X-Forwarded-Proto> to the value of
C<psgi.url_scheme>, C<X-Real-IP> to the value of C<REMOTE_ADDR>, and C<Host>
to the host and port number of a URI (if given).
 
This is called internally.

 view all matches for this distribution


Plack-App-Proxy

 view release on metacpan or  search on metacpan

lib/Plack/App/Proxy.pm  view on Meta::CPAN

57
58
59
60
61
62
63
64
65
66
67
sub build_headers_from_env {
    my($self, $env, $req) = @_;
 
    my $headers = $req->headers->clone;
    $headers->header("X-Forwarded-For" => $env->{REMOTE_ADDR});
    $headers->remove_header("Host") unless $self->preserve_host_header;
    $self->filter_headers( $headers );
 
    +{ map {$_ => scalar $headers->header($_) } $headers->header_field_names };
}

 view all matches for this distribution


Plack-Middleware-GeoIP

 view release on metacpan or  search on metacpan

lib/Plack/Middleware/GeoIP.pm  view on Meta::CPAN

89
90
91
92
93
94
95
96
97
98
=head1 SYNOPSIS
 
  # with Plack::Middleware::RealIP
  enable 'Plack::Middleware::RealIP',
      header => 'X-Forwarded-For',
      trusted_proxy => [ qw(192.168.1.0/24 192.168.2.1) ];
  enable 'Plack::Middleware::GeoIP',
      GeoIPDBFile => [ '/path/to/GeoIP.dat', '/path/to/GeoIPCity.dat' ],
      GeoIPEnableUTF8 => 1;

 view all matches for this distribution


Plack-Middleware-Greylist

 view release on metacpan or  search on metacpan

t/01-greylist.t  view on Meta::CPAN

37
38
39
40
41
42
43
44
45
46
47
        };
        return $app->($env);
    };
};
 
# Trust the "X-Forwarded-For" header
enable "ReverseProxy";
 
enable "Greylist",
  default_rate => 5,
  retry_after  => 120,

t/01-greylist.t  view on Meta::CPAN

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
test_psgi
  app    => $handler,
  client => sub($cb) {
 
    for my $suff ( 1 .. 5 ) {
        my $req = HEAD "/", "X-Forwarded-For" => "172.16.0.${suff}";
        my $res = $cb->($req);
        is $res->code, HTTP_OK, "request ok";
    }
 
    my $req = HEAD "/", "X-Forwarded-For" => "172.16.0.10";
    my $res = $cb->($req);
    is $res->code, HTTP_TOO_MANY_REQUESTS, "too many requests";
 
    is \@logs, [ { level => "warn", message => "Rate limiting 172.16.0.10 after 6/5 for 172.16.0.0/24" } ], "logs";

t/01-greylist.t  view on Meta::CPAN

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
test_psgi
  app    => $handler,
  client => sub($cb) {
 
    for my $suff ( 1 .. 5 ) {
        my $req = HEAD "/", "X-Forwarded-For" => "13.96.0.${suff}";
        my $res = $cb->($req);
        is $res->code, HTTP_OK, "request ok";
    }
 
    my $req = HEAD "/", "X-Forwarded-For" => "13.104.0.1";
    my $res = $cb->($req);
    is $res->code, HTTP_TOO_MANY_REQUESTS, "too many requests";
 
    is \@logs, [ { level => "warn", message => "Rate limiting 13.104.0.1 after 6/5 for 13.104.0.0/14" } ], "logs";

t/01-greylist.t  view on Meta::CPAN

144
145
146
147
148
149
150
151
152
153
154
test_psgi
  app    => $handler,
  client => sub($cb) {
 
    my $req = HEAD "/", "X-Forwarded-For" => "172.16.1.1";
 
    for ( 1 .. 6 ) {
        my $res = $cb->($req);
        is $res->code, HTTP_OK, "request ok";
    }

t/01-greylist.t  view on Meta::CPAN

165
166
167
168
169
170
171
172
173
174
175
test_psgi
  app    => $handler,
  client => sub($cb) {
 
    my $req = HEAD "/", "X-Forwarded-For" => "107.20.17.110";
 
    for ( 1 .. 3 ) {
        my $res = $cb->($req);
        is $res->code, HTTP_OK, "request ok";
    }

t/01-greylist.t  view on Meta::CPAN

180
181
182
183
184
185
186
187
188
189
  }
 
  is \@logs, [ { level => "warn", message => "Rate limiting 107.20.17.110 after 4/3 for 107.20.0.0/14" } ], "logs";
 
  {
      my $res = $cb->( HEAD "/", "X-Forwarded-For" => "107.20.17.111" );
      is $res->code, HTTP_OK, "request ok (different IP in same block)";
  }
 
};

t/01-greylist.t  view on Meta::CPAN

196
197
198
199
200
201
202
203
204
205
206
test_psgi
  app    => $handler,
  client => sub($cb) {
 
    my $req = HEAD "/", "X-Forwarded-For" => "13.67.224.13";
 
    for ( 1 .. 2 ) {
        my $res = $cb->($req);
        is $res->code, HTTP_FORBIDDEN, "forbidden";
    }

t/01-greylist.t  view on Meta::CPAN

222
223
224
225
226
227
228
229
230
231
232
test_psgi
  app    => $handler,
  client => sub($cb) {
 
    my $req = HEAD "/", "X-Forwarded-For" => "66.249.64.1";
 
    for ( 1 .. 10 ) {
        my $res = $cb->($req);
        is $res->code, HTTP_OK, "request ok";
    }

 view all matches for this distribution


Plack-Middleware-LemonLDAP-BasicAuth

 view release on metacpan or  search on metacpan

lib/Plack/Middleware/LemonLDAP/BasicAuth.pm  view on Meta::CPAN

35
36
37
38
39
40
41
42
43
44
45
my $xheader = $env->{'X_FORWARDED_FOR'};
$xheader .= ", " if ($xheader);
$xheader .= $env->{REMOTE_ADDR};
 
my $soap_headers = HTTP::Headers->new( "X-Forwarded-For" => $xheader );
 
my $soap = SOAP::Lite->proxy(
    $self->portal || '',
    default_headers => $soap_headers,
)->uri('urn:Lemonldap::NG::Common::CGI::SOAPService');

 view all matches for this distribution


Plack-Middleware-RealIP

 view release on metacpan or  search on metacpan

lib/Plack/Middleware/RealIP.pm  view on Meta::CPAN

60
61
62
63
64
65
66
67
68
69
70
Plack::Middleware::RealIP - Override client IP with header value provided by proxy/load balancer
 
=head1 SYNOPSIS
 
  enable 'Plack::Middleware::RealIP',
      header => 'X-Forwarded-For',
      trusted_proxy => [qw(192.168.1.0/24 192.168.2.1)];
 
=head1 DESCRIPTION
 
Plack::Middleware::RealIP is loose port of the Apache module

 view all matches for this distribution


Plack-Middleware-XForwardedFor

 view release on metacpan or  search on metacpan

lib/Plack/Middleware/XForwardedFor.pm  view on Meta::CPAN

1
2
3
4
5
6
7
# ABSTRACT: Plack middleware to handle X-Forwarded-For headers
$Plack::Middleware::XForwardedFor::VERSION = '0.172050';
use strict;
use Plack::Util::Accessor qw(trust);

lib/Plack/Middleware/XForwardedFor.pm  view on Meta::CPAN

51
52
53
54
55
56
57
58
59
60
1;
 
=head1 NAME
 
Plack::Middleware::XForwardedFor - Plack middleware to handle X-Forwarded-For headers
 
=head1 VERSION
 
version 0.172050

lib/Plack/Middleware/XForwardedFor.pm  view on Meta::CPAN

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
      trust => [qw(127.0.0.1/8)];
  };
 
=head1 DESCRIPTION
 
C<Plack::Middleware::XForwardedFor> will look for C<X-Forwarded-For>
header in the incoming request and change C<REMOTE_ADDR> to the
real client IP
 
=head1 PARAMETERS
 
=over
 
=item trust
 
If not specified then all addressed are trusted and C<REMOTE_ADDR> will be set to the
first IP in the C<X-Forwarded-For> header.
 
If given, it should be a list of IPs or Netmasks that can be trusted. Starting with the IP
of the client in C<REMOTE_ADDR> then the IPs in the C<X-Forwarded-For> header from right to left.
The first untrusted IP found is set to be C<REMOTE_ADDR>
 
=back
 
=head1 SEE ALSO

 view all matches for this distribution


Plack

 view release on metacpan or  search on metacpan

t/Plack-Middleware/access_log.t  view on Meta::CPAN

31
32
33
34
35
36
37
38
39
40
41
42
43
    };
};
 
{
    my $req = GET "http://example.com/";
    $req->header("Host" => "example.com", "X-Forwarded-For" => "192.0.2.1");
 
    my $fmt = "%P %{Host}i %p %{X-Forwarded-For}i %{Content-Type}o %{%m %y}t %v";
    $test->($fmt)->($req);
    chomp $log;
    my $month_year = POSIX::strftime('%m %y', localtime);
    is $log, "$$ example.com 80 192.0.2.1 text/plain [$month_year] example.com";
}

 view all matches for this distribution


RPC-XML

 view release on metacpan or  search on metacpan

lib/RPC/XML/Server.pm  view on Meta::CPAN

2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
B<SOCKADDR_IN> structure.
 
=item request
 
The L<HTTP::Request|HTTP::Request> object for this request. Can be used to read
HTTP headers sent by the client (C<X-Forwarded-For> for your access checks, for
example).
 
=back
 
Those keys should only be referenced within method code itself, as they are

 view all matches for this distribution


Regexp-Log-BlueCoat

 view release on metacpan or  search on metacpan

lib/Regexp/Log/BlueCoat.pm  view on Meta::CPAN

197
198
199
200
201
202
203
204
205
206
207
# %V    cs-version The protocol (HTTP, FTP) version used by the client.  Yes
# %W    sc-filter-result UFS event (May differ between Websense or SmartFilter or others).  No
    # this is handled in _postprocess() and is unsupported yet
    '%W' => '',
 
# %X    cs (X-Forwarded-For) The IP address of the device which sent the HTTP request.  No
# %Y    - [Not used.] -
    '%Y' => '',
 
    # %Z    - [Not used.] -
    '%Z' => '',

lib/Regexp/Log/BlueCoat.pm  view on Meta::CPAN

435
436
437
438
439
440
441
442
443
444
445
%U    cs-uri-stem          Object path from request URL
 %V    cs-version           The protocol (HTTP, FTP) version used by
                            the client.
 %W    sc-filter-result     UFS event (May differ between Websense or
                            SmartFilter or others).
 %X    cs (X-Forwarded-For) The IP address of the device which sent
                            the HTTP request.
 %Y    -                    [Not used.]
 %Z    -                    [Not used.]
 
=head1 URL FILTERING SYSTEMS

 view all matches for this distribution


( run in 0.457 second using v1.01-cache-2.11-cpan-4e96b696675 )