Here's a patch for Apache::Compress that passes off proxied requests to
mod_proxy.

Without this patch Apache::Compress will return an internal server error
since it can't find the proxied URI on the local filesystem.

Much of the patch was lifted from chapter 7 of the Eagle book.

Right now the code requires you to write proxy settings twice (i.e. in the
FileMatch block for Apache::Compress and in the mod_proxy section):

<FilesMatch "\.(htm|html)$">
        SetHandler      perl-script
        PerlSetVar      PerlPassThru '/proxy/ =>
                        http://private.company.com/,
                        /other/ => http://www.someother.co.uk'
        PerlHandler     Apache::Compress
</FilesMatch>

ProxyRequests On
ProxyPass               /proxy          http://private.company.com/
ProxyPassReverse        /proxy          http://private.company.com/
ProxyPass               /other          http://www.someother.co.uk/
ProxyPassReverse        /other          http://www.someother.co.uk/

34a35,49
> 
>   if ($r->proxyreq) {
>       use Apache::Proxy;
>       my $uri = $r->uri();
> 
>       my %mappings = split /\s*(?:,|=>)\s*/, $r->dir_config('PerlPassThru');
> 
>       for my $src (keys %mappings) {
>         next unless $uri =~ s/^$src/$mappings{$src}/;
>       }
> 
>       my $status = Apache::Proxy->pass($r, $uri);
>       return $status;
>   }
> 

Reply via email to