view release on metacpan or search on metacpan
lib/Catalyst/Engine/Apache.pm view on Meta::CPAN
my $headers = $self->apache->headers_in;
unless ( $c->config->{using_frontend_proxy} ) {
last PROXY_CHECK if $c->request->address ne '127.0.0.1';
last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
}
last PROXY_CHECK unless $headers->{'X-Forwarded-For'};
# If we are running as a backend server, the user will always appear
# as 127.0.0.1. Select the most recent upstream IP (last in the list)
my ($ip) = $headers->{'X-Forwarded-For'} =~ /([^,\s]+)$/;
$c->request->address( $ip );
}
$c->request->hostname( $self->apache->connection->remote_host );
$c->request->protocol( $self->apache->protocol );
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_engine_request_headers.t view on Meta::CPAN
my $request = GET( 'http://localhost/dump/request',
'User-Agent' => 'MyAgen/1.0',
'X-Whats-Cool' => 'Catalyst',
'X-Multiple' => [ 1 .. 5 ],
'X-Forwarded-Host' => 'frontend.server.com',
'X-Forwarded-For' => '192.168.1.1, 1.2.3.4',
);
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content_type, 'text/plain', 'Response Content-Type' );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Engine/HTTP/Prefork.pm view on Meta::CPAN
# Add headers
my $headers = $h->getHeaders();
$self->{client}->{headers} = $headers;
# prepare_connection and prepare_path need a few headers in %ENV
$ENV{HTTP_X_FORWARDED_FOR} = $headers->{'X-Forwarded-For'}
if $headers->{'X-Forwarded-For'};
$ENV{HTTP_X_FORWARDED_HOST} = $headers->{'X-Forwarded-Host'}
if $headers->{'X-Forwarded-Host'};
# Determine whether we will keep the connection open after the request
my $connection = $headers->{Connection};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Engine/PSGI.pm view on Meta::CPAN
=item *
When your application runs behind the frontend proxy like nginx or
lighttpd, this Catalyst engine doesn't automatically recognize the
incoming headers like C<X-Forwarded-For>, because respecting these
headers by default causes a potential security issue.
You have to enable L<Plack::Middleware::ReverseProxy> or
L<Plack::Middleware::ForwardedHeaders> to automatically promote those
forwarded headers into C<REMOTE_ADDR> hence IP address of the request.
view all matches for this distribution
view release on metacpan or search on metacpan
t/13-extjs-cachefly.t view on Meta::CPAN
$mech->content_contains('http://extjs.cachefly.net/',
"pages are using the ExtJS CacheFly links");
# mimic that the webserver is running behind a reverse proxy that proxies from
# HTTPS to HTTP
$mech->default_header('X-Forwarded-For' => '127.0.0.1');
$mech->default_header('X-Forwarded-Host' => 'localhost');
$mech->default_header('X-Forwarded-Port' => 443);
# get basic template, no Metadata
$mech->get_ok('/autocrud/helloworld', 'Get Hello World page (HTTPS)');
view all matches for this distribution
view release on metacpan or search on metacpan
DEPLOYMENT.md view on Meta::CPAN
location / {
proxy_pass http://catalyst:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst.pm view on Meta::CPAN
Catalyst will automatically detect this situation when you are running
the frontend and backend servers on the same machine. The following
changes are made to the request.
$c->req->address is set to the user's real IP address, as read from
the HTTP X-Forwarded-For header.
The host value for $c->req->base and $c->req->uri is set to the real
host, as read from the HTTP X-Forwarded-Host header.
Additionally, you may be running your backend application on an insecure
view all matches for this distribution
view release on metacpan or search on metacpan
option abortonclose
option httpclose
balance roundrobin
# capture request header X-Forwarded-For len 15
capture response header X-Serverside-Cache len 30
server cache1 10.10.118.41:80 maxconn 400 check inter 2000 fall 8 weight 3
server cache2 10.10.118.43:80 maxconn 400 check inter 2000 fall 8 weight 2
server cache4 10.10.118.44:80 maxconn 400 check inter 2000 fall 8 weight 2
# option httpchk
## option httpchk /img/logo.png
#
# balance roundrobin
#
## capture request header X-Forwarded-For len 15
# capture response header X-Serverside-Cache len 30
#
# server testcache2 10.10.118.3:1080 maxconn 100 check inter 2000 fall 3
# server testcache4 10.10.118.4:1080 maxconn 100 check inter 2000 fall 3
# server bck 127.0.0.1:8881 check backup
option abortonclose
option httpclose
balance roundrobin
# capture request header X-Forwarded-For len 15
capture response header Cache-Control len 64
# server www17 10.10.118.72:80 maxconn 100 check inter 2000 fall 3
server www18 10.10.118.73:80 maxconn 100 check inter 2000 fall 3
server www19 10.10.118.74:80 maxconn 100 check inter 2000 fall 3
# option httpchk
## option httpchk /img/logo.png
#
# balance roundrobin
#
## capture request header X-Forwarded-For len 15
# capture response header Cache-Control len 15
#
# server www20 10.10.118.75:80 maxconn 100 check inter 2000 fall 3
# server bck 127.0.0.1:8881 check backup
#
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convos/Manual/HttpHeaders.pod view on Meta::CPAN
# generic headers for correct handling of ws and http
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
# set this if you are running SSL
proxy_set_header X-Forwarded-HTTPS 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DDG/Rewrite.pm view on Meta::CPAN
predicate => 'has_proxy_ssl_session_reuse',
);
has proxy_x_forwarded_for => (
is => 'ro',
default => sub { 'X-Forwarded-For $proxy_add_x_forwarded_for' }
);
has post_body => (
is => 'ro',
predicate => 'has_post_body',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Deployment.pod view on Meta::CPAN
location @proxy {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://backendurl;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Manual/Deployment.pod view on Meta::CPAN
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Start NGINX and Starman, and your app will be accessible through the proxy.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EV/Websockets.pm view on Meta::CPAN
C<protocol> sets the WebSocket subprotocol name advertised by the server vhost.
The vhost name C<default> is reserved and will croak if used.
C<$headers> in C<on_connect> is a hashref of client request headers
(Path, Host, Origin, Cookie, Authorization, Sec-WebSocket-Protocol,
User-Agent, X-Forwarded-For).
C<Path> is the request URI (e.g., C</chat>).
C<headers> is an optional hashref of headers to inject into the HTTP upgrade
response (e.g., C<Set-Cookie>).
view all matches for this distribution
view release on metacpan or search on metacpan
t/sample_mail.txt view on Meta::CPAN
Received: by mail-ve0-f176.google.com with SMTP id c14so4732160vea.21
for <tenshouser@tensho-saki-host.com>; Mon, 18 Nov 2013 01:35:15 -0800 (PST)
X-Received: by 10.58.136.231 with SMTP id qd7mr14608129veb.1.1384767315376;
Mon, 18 Nov 2013 01:35:15 -0800 (PST)
X-Forwarded-To: tenshouser@tensho-saki-host.com
X-Forwarded-For: hirobanex@gmail.com tenshouser@tensho-saki-host.com
Delivered-To: hirobanex@gmail.com
Received: by 10.52.245.10 with SMTP id xk10csp197545vdc;
Mon, 18 Nov 2013 01:35:15 -0800 (PST)
X-Received: by 10.236.30.70 with SMTP id j46mr2312552yha.73.1384767314704;
Mon, 18 Nov 2013 01:35:14 -0800 (PST)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gantry/Utils/PerlbalFixup.pm view on Meta::CPAN
use strict;
sub handler {
my $r = shift;
$r->connection->remote_ip( $r->header_in('X-Forwarded-For') )
if $r->header_in('X-Forwarded-For') ne "";
return 1;
}
1;
lib/Gantry/Utils/PerlbalFixup.pm view on Meta::CPAN
#can be any Perl*Handler
PerlInitHandler Gantry::Utils::PerlbalFixup
=head1 DESCRIPTION
This module will set the proper client ip using the X-Forwarded-For header
which is set by Perlbal and other proxy methods. This module should be loaded
at the PerlInitHandler or PerlReadParseHeaders phase during the request life-
cycle
=head1 METHODS
=head2 handler
The apache fixup handler. Stores the value of the X-Forwarded-For header
in the remote_ip of the request's connection, so apps behind a perlbal proxy
can tell who their client is.
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBI/Gofer/Transport/mod_perl.pm view on Meta::CPAN
my ($frozen_response, $response, $response_serializer);
my $executor;
my $http_status = SERVER_ERROR;
my $remote_ip = $headers_in->{Client_ip} # e.g., cisco load balancer
|| $headers_in->{'X-Forwarded-For'} # e.g., mod_proxy (XXX may contain more than one ip)
|| $r->connection->remote_ip;
eval {
$executor = $self->executor_for_apache_request($r);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Grimlock.pm view on Meta::CPAN
error_log /var/log/nginx/error.log;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:5000/;
}
location /static {
root /path/to/grimlock.me;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTTP/Promise/Headers.pm view on Meta::CPAN
sub x_content_type_options { return( shift->_set_get_one( 'X-Content-Type-Options', @_ ) ); }
# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control>
sub x_dns_prefetch_control { return( shift->_set_get_one( 'X-DNS-Prefetch-Control', @_ ) ); }
# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For>
sub x_forwarded_for { return( shift->_set_get_one( 'X-Forwarded-For', @_ ) ); }
# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host>
sub x_forwarded_host { return( shift->_set_get_one( 'X-Forwarded-Host', @_ ) ); }
# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto>
lib/HTTP/Promise/Headers.pm view on Meta::CPAN
See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control>
=head2 x_forwarded_for
This sets or gets the C<X-Forwarded-For> header value. It takes a string value.
Example:
X-Forwarded-For: 2001:db8:85a3:8d3:1319:8a2e:370:7348
X-Forwarded-For: 203.0.113.195
X-Forwarded-For: 203.0.113.195, 2001:db8:85a3:8d3:1319:8a2e:370:7348
See also L</host>, L</forwarded>, L</x_forwarded_host>, L</x_forwarded_proto>, L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For>
=head2 x_forwarded_host
This sets or gets the C<X-Forwarded-Host> header value. It takes a string value.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTTP/Proxy.pm view on Meta::CPAN
The content of the Via: header. Setting it to an empty string will
prevent its addition. (default: C<$hostname (HTTP::Proxy/$VERSION)>)
=item x_forwarded_for
If set to a true value, the proxy will send the C<X-Forwarded-For:> header.
(default: true)
=back
=head2 Connection handling methods
view all matches for this distribution
view release on metacpan or search on metacpan
t/parse-cgi.t view on Meta::CPAN
use HTTP::Response::CGI;
# Example test values.
my @headers = (
'Content-type: text/html',
'X-Forwarded-For: 127.0.0.1',
);
my $body = 'This is the body.';
my $output;
my $response;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Haineko/HTTPD.pm view on Meta::CPAN
}
if( ref $mesg eq 'HASH' ) {
# Respond as a JSON
require Haineko::SMTPD::Session;
my $addr = [ split( ',', $self->req->header('X-Forwarded-For') || q() ) ];
my $sess = Haineko::SMTPD::Session->new(
'referer' => $self->req->referer // undef,
'response' => [ $mesg ],
'remoteaddr' => pop @$addr || $self->req->address // undef,
'remoteport' => $self->req->env->{'REMOTE_ADDR'} // undef,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IO/K8s/Apimachinery/Pkg/Apis/Meta/V1/APIGroup.pm view on Meta::CPAN
preferredVersion is the version preferred by the API server, which probably is the storage version.
=head2 serverAddressByClientCIDRs
a map of client CIDR to server address that is serving this group. This is used to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multi...
=head2 versions
versions are the versions supported in this group.
view all matches for this distribution
view release on metacpan or search on metacpan
share/templates/suricata_outputs.tt view on Meta::CPAN
community-id-seed: 0
xff:
enabled: yes
mode: extra-data
deployment: reverse
header: X-Forwarded-For
types:
- alert:
payload: yes
payload-buffer-size: 64kb
packet: yes
share/templates/suricata_outputs.tt view on Meta::CPAN
level: Info
xff:
enabled: yes
mode: extra-data
deployment: reverse
header: X-Forwarded-For
pcap-file: false
community-id: false
community-id-seed: 0
types:
- http:
share/templates/suricata_outputs.tt view on Meta::CPAN
force-hash: [sha1, md5]
xff:
enabled: no
mode: extra-data
deployment: reverse
header: X-Forwarded-For
[% END %]
##
## regular files
##
share/templates/suricata_outputs.tt view on Meta::CPAN
community-id-seed: 0
xff:
enabled: yes
mode: extra-data
deployment: reverse
header: X-Forwarded-For
types:
- alert:
payload: yes
payload-buffer-size: 64kb
packet: 'yes'
share/templates/suricata_outputs.tt view on Meta::CPAN
filename: /var/log/suricata/flows/current/http.json
xff:
enabled: yes
mode: extra-data
deployment: reverse
header: X-Forwarded-For
pcap-file: false
community-id: false
community-id-seed: 0
types:
- http:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Jifty/Plugin/AccessLog.pm view on Meta::CPAN
The file to log to; defaults to F<log/access_log>.
=item respect_proxy
If set to a true value, will display the C<X-Forwarded-For> header as
the originating IP of requests.
=item format
The format string to use when logging. This module attempts to be as
lib/Jifty/Plugin/AccessLog.pm view on Meta::CPAN
}
};
my %ESCAPES = (
'%' => sub { '%' },
a => sub { ($self->respect_proxy && $r->header("X-Forwarded-For")) || $r->address },
C => sub { my $c = { CGI::Cookie->fetch() }->{+shift}; $c ? $c->value : undef },
D => sub { sprintf "%.3fms", (Time::HiRes::time - $self->start)*1000 },
e => sub { $r->env->{+shift} },
h => sub { ($self->respect_proxy && $r->header("X-Forwarded-For")) || $r->remote_host || $r->address },
i => sub { $r->header(shift) },
l => sub { substr( Jifty->web->session->id || '-', 0, 8 ) },
m => sub { $r->method },
n => sub { $r->template_argument($_[0]) || $r->argument($_[0]) },
o => sub { Jifty->web->response->header(shift) },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Lemonldap/NG/Handler/Lib/AuthBasic.pm view on Meta::CPAN
# Send a create session request to the Portal
# @return true if the session is created, else false
sub createSession {
my ( $class, $req, $id ) = @_;
# Add client IP as X-Forwarded-For IP in request
my $xheader = $req->env->{'HTTP_X_FORWARDED_FOR'};
$xheader .= ", " if ($xheader);
$xheader .= $req->address;
my $creds = $req->env->{'HTTP_AUTHORIZATION'};
lib/Lemonldap/NG/Handler/Lib/AuthBasic.pm view on Meta::CPAN
$class->logger->debug("AuthBasic authentication for user: $user");
my $url = $class->tsv->{portal}->($req) . "/sessions/global/$id?auth";
$url =~ s#//sessions/#/sessions/#g;
my $get = HTTP::Request->new( POST => $url );
$get->header( 'X-Forwarded-For' => $xheader );
$get->header( 'Content-Type' => 'application/x-www-form-urlencoded' );
$get->header( Accept => 'application/json' );
$get->content(
build_urlencoded(
user => $user,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MVC/Neaf/Request.pm view on Meta::CPAN
# Should we join them all? Maybe...
=head2 client_ip()
Returns the IP of the client.
If C<X-Forwarded-For> header is set, returns that instead.
=cut
sub client_ip {
my $self = shift;
return $self->{client_ip} ||= do {
my @fwd = $self->header_in( 'X-Forwarded-For', '.*' );
@fwd == 1 && $fwd[0] || $self->do_get_client_ip || "127.0.0.1";
};
};
=head2 http_version()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/BlogSpam.pm view on Meta::CPAN
use Mojo::IOLoop;
use Scalar::Util 'weaken';
our $VERSION = '0.12';
# TODO: X-Forwarded-For in Config per index steuern
# TODO: - Check for blacklist/whitelist/max words etc. yourself.
# - Create a route condition for posts.
# -> $r->post('/comment')->over('blogspam')->to('#');
our @OPTION_ARRAY =
lib/Mojolicious/Plugin/BlogSpam.pm view on Meta::CPAN
# No ip manually given
unless ($obj->ip) {
# Get forwarded ip
if (my $ip = $headers->to_hash->{'X-Forwarded-For'}) {
$obj->ip( split(/\s*,\s*/, $ip) );
};
# Get host ip, because X-Forwarded-For wasn't set
unless ($obj->ip) {
$obj->ip( split(/\s*:\s*/, ($headers->host || '')) );
};
};
lib/Mojolicious/Plugin/BlogSpam.pm view on Meta::CPAN
$bs->ip('192.168.0.1');
my $ip = $bs->ip;
The ip address of the commenter.
Defaults to the ip address of the request.
Supports C<X-Forwarded-For> proxy information.
=head2 link
$bs->link('http://grimms-abenteuer.de/');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/CGI.pm view on Meta::CPAN
.----------------------------------------.
| Header | Variable |
|-----------------|----------------------|
| Referer | HTTP_REFERER |
| User-Agent | HTTP_USER_AGENT |
| X-Forwarded-For | HTTP_X_FORWARDED_FOR |
'----------------------------------------'
=head2 register
$self->register($app, [ $route => $script ]);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/ClientIP.pm view on Meta::CPAN
state $key = '__plugin_clientip_ip';
return $c->stash($key) if $c->stash($key);
my $xff = $c->req->headers->header('X-Forwarded-For') // '';
my @candidates = reverse grep { $_ } split /,\s*/, $xff;
my $ip = $self->_find(\@candidates) // $c->tx->remote_address;
$c->stash($key => $ip);
return $ip;
lib/Mojolicious/Plugin/ClientIP.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
Mojolicious::Plugin::ClientIP - Get client's IP address from X-Forwarded-For
=head1 SYNOPSIS
use Mojolicious::Lite;
lib/Mojolicious/Plugin/ClientIP.pm view on Meta::CPAN
app->start;
=head1 DESCRIPTION
Mojolicious::Plugin::ClientIP is a Mojolicious plugin to get an IP address looks like client, not proxy, from X-Forwarded-For header.
=head1 METHODS
=head2 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.
=head1 OPTIONS
=head2 ignore
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojo/Server/Hypnotoad.pm view on Meta::CPAN
=head2 proxy
proxy => 1
Activate reverse proxy support, which allows for the C<X-Forwarded-For> and C<X-Forwarded-Proto> headers to be picked
up automatically, defaults to the value of L<Mojo::Server/"reverse_proxy">.
=head2 requests
requests => 50
view all matches for this distribution