view release on metacpan or search on metacpan
xt/compat/lite_app.t view on Meta::CPAN
689690691692693694695696697698699700701702703# 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/
)
}
# Reverse proxy with "X-Forwarded-Proto"
xt/compat/lite_app.t view on Meta::CPAN
view all matches for this distribution
707708709710711712713714715716717718719
$t
->get_ok(
'/0'
=> {
'X-Forwarded-Proto'
=>
'https'
})->status_is(200)
->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'
})
->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 release on metacpan or search on metacpan
lib/Mojolicious/Plugin/RemoteAddr.pm view on Meta::CPAN
1415161718192021222324foreach
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
43444546474849505152
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
view all matches for this distribution
63646566676869707172'X-Real-IP'
request header
=item 'x-forwarded-for'
'X-Forwarded-For' request header
=item 'tx'
current request transaction
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/SecureOnly.pm view on Meta::CPAN
view all matches for this distribution
3233343536373839404142
});
}
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 release on metacpan or search on metacpan
t/01_ip_headers.t view on Meta::CPAN
view all matches for this distribution
28293031323334353637383940414243444546474849505152535455565758596061626364656667686970
->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 release on metacpan or search on metacpan
lib/Net/API/Telegram.pm view on Meta::CPAN
view all matches for this distribution
795796797798799800801802803804805806807my
$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 release on metacpan or search on metacpan
lib/Net/FullAuto/ISets/Local/EmailServer_is.pm view on Meta::CPAN
view all matches for this distribution
12501251125212531254125512561257125812591260'%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 release on metacpan or search on metacpan
lib/Net/WURFL/ScientiaMobile.pm view on Meta::CPAN
view all matches for this distribution
243244245246247248249250251252253254255256257258# 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 release on metacpan or search on metacpan
lib/Net/WebSocket/EVx.pod view on Meta::CPAN
view all matches for this distribution
7172737475767778798081
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 release on metacpan or search on metacpan
757758759760761762763764765766Changes
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.
885886887888889890891892893894*) 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.
view all matches for this distribution
65266527652865296530653165326533653465356536*) 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 release on metacpan or search on metacpan
OpenInteract/ApacheStartup.pm view on Meta::CPAN
view all matches for this distribution
11121314151617181920212223242526272829$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 release on metacpan or search on metacpan
lib/POE/Component/Server/Bayeux.pm view on Meta::CPAN
537538539540541542543544545546547
$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
view all matches for this distribution
562563564565566567568569570571sub
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 release on metacpan or search on metacpan
lib/POE/Component/XUL.pm view on Meta::CPAN
view all matches for this distribution
967968969970971972973974975976977978local
$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 release on metacpan or search on metacpan
examples/7.2.3/asup02.txt view on Meta::CPAN
view all matches for this distribution
12345678From 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 release on metacpan or search on metacpan
lib/Paws/ELBv2/SourceIpConditionConfig.pm view on Meta::CPAN
view all matches for this distribution
484950515253545556575859and 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 release on metacpan or search on metacpan
share/tmpl/nginx/host_conf.nginx view on Meta::CPAN
view all matches for this distribution
6364656667686970717273proxy_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 release on metacpan or search on metacpan
share/tmpl/nginx/host_conf.nginx view on Meta::CPAN
view all matches for this distribution
5960616263646566676869proxy_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 release on metacpan or search on metacpan
share/tmpl/nginx/vhost-load-balancer.nginx view on Meta::CPAN
view all matches for this distribution
2425262728293031323334proxy_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 release on metacpan or search on metacpan
lib/Perlbal/Plugin/ForwardedFor.pm view on Meta::CPAN
3435363738394041424344}
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
6061626364656667686970717273747576777879__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
view all matches for this distribution
9899100101102103104105106107108=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 release on metacpan or search on metacpan
lib/Perlbal/BackendHTTP.pm view on Meta::CPAN
view all matches for this distribution
271272273274275276277278279280281282283284285286287if
(
$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 release on metacpan or search on metacpan
lib/Plack/App/Prerender.pm view on Meta::CPAN
4344454647484950515253unless
(
$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
view all matches for this distribution
279280281282283284285286287288It will
default
to the following headers:
=over
=item C<X-Forwarded-For>
=item C<X-Forwarded-Host>
=item C<X-Forwarded-Port>
view release on metacpan or search on metacpan
lib/Plack/App/Proxy/WebSocket.pm view on Meta::CPAN
119120121122123124125126127128129my
$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
view all matches for this distribution
213214215216217218219220221222223=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 release on metacpan or search on metacpan
lib/Plack/App/Proxy.pm view on Meta::CPAN
view all matches for this distribution
5758596061626364656667sub
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 release on metacpan or search on metacpan
lib/Plack/Middleware/GeoIP.pm view on Meta::CPAN
view all matches for this distribution
89909192939495969798=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 release on metacpan or search on metacpan
t/01-greylist.t view on Meta::CPAN
3738394041424344454647
};
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
979899100101102103104105106107108109110111test_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
121122123124125126127128129130131132133134135test_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
144145146147148149150151152153154test_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
165166167168169170171172173174175test_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
180181182183184185186187188189
}
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
196197198199200201202203204205206test_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
view all matches for this distribution
222223224225226227228229230231232test_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 release on metacpan or search on metacpan
lib/Plack/Middleware/LemonLDAP/BasicAuth.pm view on Meta::CPAN
view all matches for this distribution
3536373839404142434445my
$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 release on metacpan or search on metacpan
lib/Plack/Middleware/RealIP.pm view on Meta::CPAN
view all matches for this distribution
6061626364656667686970Plack::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 release on metacpan or search on metacpan
lib/Plack/Middleware/XForwardedFor.pm view on Meta::CPAN
1234567package
Plack::Middleware::XForwardedFor;
# ABSTRACT: Plack middleware to handle X-Forwarded-For headers
$Plack::Middleware::XForwardedFor::VERSION
=
'0.172050'
;
use
strict;
use
warnings;
lib/Plack/Middleware/XForwardedFor.pm view on Meta::CPAN
515253545556575859601;
=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
view all matches for this distribution
66676869707172737475767778798081828384858687888990
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 release on metacpan or search on metacpan
t/Plack-Middleware/access_log.t view on Meta::CPAN
view all matches for this distribution
31323334353637383940414243
};
};
{
$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 release on metacpan or search on metacpan
lib/RPC/XML/Server.pm view on Meta::CPAN
view all matches for this distribution
23232324232523262327232823292330233123322333B<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 release on metacpan or search on metacpan
lib/Regexp/Log/BlueCoat.pm view on Meta::CPAN
197198199200201202203204205206207# %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
view all matches for this distribution
435436437438439440441442443444445%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