OpenInteract

 view release on metacpan or  search on metacpan

OpenInteract/ApacheStartup.pm  view on Meta::CPAN

use Apache;
#use Apache::DBI;
use File::Path;
use OpenInteract::DBI;
use OpenInteract::Startup;

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

sub initialize {
    my ( $class, $bc_file ) = @_;

    DEBUG && _w( 1, "ApacheStartup: Reading in information for configuration: $bc_file" );

conf/sample-httpd_modperl.conf  view on Meta::CPAN


<Perl>
 use lib qw( %%WEBSITE_DIR%% );
</Perl>

# This reads in all your SPOPS objects, sets up aliases, database
# handles, template processing objects, etc.

PerlRequire %%WEBSITE_DIR%%/conf/startup.pl

# This is used to read the 'X-Forwarded-For' header created by the
# mod_proxy_add_forward.c Apache module that should be compiled into
# your front-end proxy server. If you don't have this, then every
# request will appear to come from the proxy server, which can be
# annoying.

PerlPostReadRequestHandler OpenInteract::ProxyRemoteAddr

PerlSetVar  OIStashClass      %%STASH_CLASS%%

# This sends all incoming requests to the OpenInteract Apache content

doc/sample-httpd-modperl.html  view on Meta::CPAN


&lt;Perl&gt;
 use lib qw( %%WEBSITE_DIR%% );
&lt;/Perl&gt;

# This reads in all your SPOPS objects, sets up aliases, database
# handles, template processing objects, etc.

PerlRequire %%WEBSITE_DIR%%/conf/startup.pl

# This is used to read the 'X-Forwarded-For' header created by the
# mod_proxy_add_forward.c Apache module that should be compiled into
# your front-end proxy server. If you don't have this, then every
# request will appear to come from the proxy server, which can be
# annoying.

PerlPostReadRequestHandler OpenInteract::ProxyRemoteAddr

PerlSetVar  OIStashClass      %%STASH_CLASS%%

# This sends all incoming requests to the OpenInteract Apache content



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