HTTP::Proxy::Selective - Simple HTTP Proxy which serves some paths from locations on local disk.
use HTTP::Proxy; use HTTP::Proxy::Selective; my $filter = { 'www.example.com' => { 'css/' => '/home/t0m/example/css', 'js' => '/home/t0m/example/js', }, }; my $proxy = HTTP::Proxy->new(); $proxy->push_filter( method => 'GET, HEAD', request => HTTP::Proxy::Selective->new($filter) ); $proxy->start;
See the script shipped in the distribution selective_proxy for a slightly more complex example of use.
selective_proxy
HTTP::Proxy::Selective acts as a filter for HTTP::Proxy. You pass it a filter data structure when you create it (as per the example above), and any URLs requested through the proxy which match the filter are served from the path on local disk specified by the configuration.
Note that if a file is a filtered path is not found on local disk, then a 404 error is generated, it is not sent to the origin server.
Constructs an instance (validating the filter etc as it does so).
Method which performs the filtering, called by HTTP::Proxy.
A binary release of the latest version of this software for Windows may be found at:
http://www.venda.com/page/developertools
Tomas Doran, <bobtfish@bobtfish.net>
This software is based upon a number of other open source projects, and builds on software originally implemented by the following people.
Copyright 2008 Tomas Doran. Some rights reserved.
The development of this software was 100% funded by Venda (http://www.venda.com).
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Venda Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install HTTP::Proxy::Selective, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Proxy::Selective
CPAN shell
perl -MCPAN -e shell install HTTP::Proxy::Selective
For more information on module installation, please visit the detailed CPAN module installation guide.