Apache::FilteringProxy - A configurable rewriting proxy module for HTTP


Apache-FilteringProxy documentation  | view source Contained in the Apache-FilteringProxy distribution.

Index


NAME

Top

Apache::FilteringProxy - A configurable rewriting proxy module for HTTP servers in mod_perl.

SYNOPSIS

Top

Add the following to an Apache VirtualHost config:

    <VirtualHost ...>
        # domain with a wildcard subdomain alias (ooo...tricky)
        ServerName *.resources.somedomain.com

        ServerAdmin root@localhost.localdomain

        # some document root...empty or whatever you want to be seen if
        # mod_perl gets disabled or something similar
        DocumentRoot /var/www/html

        SetHandler  perl-script
        PerlHandler Apache::FilteringProxy
        PerlSetVar FilteringProxyMode normal
        PerlSetVar FilteringProxyConfig /some/absolute/path/to/config.xml

        ErrorLog /var/log/httpd/resources.somedomain.com-error_log
        CustomLog /var/log/httpd/resources.somedomain.com-access_log \
                  combined
    </VirtualHost>

Modify resources in the configuration file specified in FilteringProxyConfig.

    # make slashdot.org available via myslashdot.resources.somedomain.com
    <resource id="myslash" name="MySlash" url="http://www.slashdot.org">
        <host-include>slashdot.org</host-include>
        <domain-include>someotherdomain.com</domain-include>
    </resource>

Three modes are offered with this module (normal, admin, and mirror).

DESCRIPTION

Top

The Apache::FilteringProxy module provides a rewriting proxy for HTTP servers. This module was originally created to allow remote access of resources that are restricted to using IP-based authentication.

Requirements

Perl modules: LWP::UserAgent XML::EasyOBJ DBI (for admin mode)

The ability to configure a wildcard subdomain i.e. *.subdomain.apu.edu (example use below)

Modes

Three modes are offered with this module (normal, admin, and mirror).

"normal" mode is used for a specific resource that will be limited to proxying a finite number of hosts/domains.

"admin" mode is used to configure a resource that will proxy every host/domain that it encounters by rewriting *all* HTTP URLs. The main purpose for this mode is to allow for interactive additions of new resources. It is used by the administrative tool bundled with the module.

"mirror" mode is used for a site that contains URLs you need to have rewritten into the proper proxied URLs. For instance, you have a page that contains URLs for slashdot (e.g. http://slashdot.org/) and you have configured a resource named "myslashdot" which includes the domain "slashdot.org". All instances of http://slashdot.org/blah would be rewritten to ~ http://myslashdot.resources.somedomain.com/blah. So if perchance you have multiple resources with the same host or domain specified in their configuration, then the first will be used.

Examples

Example configuration for a normal proxied site:

    <VirtualHost ...>
        # domain with a wildcard subdomain alias (ooo...tricky)
        ServerName *.resources.somedomain.com

        ServerAdmin root@localhost.localdomain

        # some document root...empty or whatever you want to be seen if
        # mod_perl gets disabled or something similar
        DocumentRoot /var/www/html

        SetHandler  perl-script
        PerlHandler Apache::FilteringProxy
        PerlSetVar FilteringProxyMode normal
        PerlSetVar FilteringProxyConfig /some/absolute/path/to/config.xml

        ErrorLog /var/log/httpd/resources.somedomain.com-error_log
        CustomLog /var/log/httpd/resources.somedomain.com-access_log \
                  combined
    </VirtualHost>

Example configuration for a mirror proxied site:

    <VirtualHost ...>
        # domain with a wildcard subdomain alias (ooo...tricky)
        ServerName *.mirror.somedomain.com
        ServerAlias mirror.somedomain.com

        ServerAdmin root@localhost.localdomain

        # some document root...empty or whatever you want to be seen if
        # mod_perl gets disabled or something similar
        DocumentRoot /var/www/html

        SetHandler  perl-script
        PerlHandler Apache::FilteringProxy
        PerlSetVar FilteringProxyMode mirror
        PerlSetVar FilteringProxyServername somedomain.com
        PerlSetVar FilteringProxyResourceDomain resources.somedomain.com
        PerlSetVar FilteringProxyConfig /some/absolute/path/to/config.xml

        ErrorLog /var/log/httpd/mirror.somedomain.com-error_log
        CustomLog /var/log/httpd/mirror.somedomain.com-access_log \
                  combined
    </VirtualHost>

Example configuration for an admin proxied site:

    <VirtualHost ...>
        # domain with a wildcard subdomain alias (ooo...tricky)
        ServerName *.admin.somedomain.com

        ServerAdmin root@localhost.localdomain

        # some document root...empty or whatever you want to be seen if
        # mod_perl gets disabled or something similar
        DocumentRoot /var/www/html

        SetHandler  perl-script
        PerlHandler Apache::FilteringProxy
        PerlSetVar FilteringProxyMode admin
        PerlSetVar FilteringProxyServername somedomain.com
        PerlSetVar FilteringProxyConfig /some/absolute/path/to/config.xml

        ErrorLog /var/log/httpd/admin.somedomain.com-error_log
        CustomLog /var/log/httpd/admin.somedomain.com-access_log \
                  combined
    </VirtualHost>

NOTES

Top

Why we use a subdomain and not URI mapping:

    Much easier to translate all absolute (http://) URLs we run into
    than it is to try and catch all root relative (/) URLs

Why we use a wildcard subdomain:

    Who wants to have a hundred vhosts for proxying and have to restart 
    apache on every change?  Both multiple vhosts and multiple ports
    get old pretty quick.

COMPATIBILITY

Top

This module still does not yet implement caching abilites and may never do so. Configure it to use a real proxy if this is important to you.

SEE ALSO

Top

HTTP 1.1 RFC

http://www.w3.org/Protocols/rfc2616/rfc2616.html

mod_perl Documentation

http://perl.apache.org/

AUTHOR

Top

David Castro <dcastro@apu.edu>

COPYRIGHT

Top


Apache-FilteringProxy documentation  | view source Contained in the Apache-FilteringProxy distribution.