You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Perrin Harkins <pe...@elem.com> on 2003/04/24 04:10:51 UTC

Re: help setting up mod_perl filtering proxy?

On Tue, 2003-04-22 at 13:25, Sam wrote:
> Reading the docs, it looks like I should be able to let apache handle
> all the details of the proxying of the request and response, and just
> write code to tweak or scan the response to do the things I want to do.

Well, you can't use mod_proxy to do this for you if you want to look at
or modify the content (at least in apache 1.x).  For that, you have to
fetch the page yourself.  Lucky for you, there are many CPAN modules
already available that do this.  

> Listen 8800
> NameVirtualHost 127.0.0.1:8800
> <VirtualHost 127.0.0.1:8800>
>     # name : Filtering Proxy
>     PerlTransHandler  MyApache::ProxyPeek
>     PerlSetVar        ProxyPassThru_DumpHeaders 1
> </VirtualHost>
> MyApache::ProxyPeek exists and compiles fine. It's basically
> Apache::ProxyPassThru at this point, just for testing purposes. However
> when I tell my browser to proxy http requests through 127.0.0.1:8800 I
> just get 
> "Forbidden
> You don't have permission to access http://perl.apache.org/ on this
> server"
> Seems like I might be close?

Why don't you try putting in some debugging warnings in your ProxyPeek
module to figure out where it's having trouble?  See if it is running
the proxy_handler() sub or not.  See if you can fetch non-proxied
content from that VirtualHost.

> Do I need mod_proxy at all?

No.

> Could I still use the handlers if I set ProxyRequests on?

ProxyRequests is not applicable unless you run mod_proxy.

- Perrin



Re: help setting up mod_perl filtering proxy?

Posted by Sam <sa...@sam-i-am.com>.
> On Tue, 2003-04-22 at 13:25, Sam wrote:
> > Reading the docs, it looks like I should be able to let apache handle
> > all the details of the proxying of the request and response, and just
> > write code to tweak or scan the response to do the things I want to do.
> 
> Well, you can't use mod_proxy to do this for you if you want to look at
> or modify the content (at least in apache 1.x).  For that, you have to
> fetch the page yourself.  

aah. Ok that clears up that one. Do I even want to ask about
Apache2/mp2? That's where I got the idea i think, but it sounds like the
consensus is don't use it unless you like trouble. 
I'm developing on win32, where apache 2 runs well.. but mp2 is not quite
there yet I gather. 

> Why don't you try putting in some debugging warnings in your ProxyPeek
> module to figure out where it's having trouble?  See if it is running
> the proxy_handler() sub or not.  See if you can fetch non-proxied
> content from that VirtualHost.

of course.. 

> > Do I need mod_proxy at all?
> No.

> > Could I still use the handlers if I set ProxyRequests on?
> ProxyRequests is not applicable unless you run mod_proxy.

ok, I get the idea, no mod_proxy, no proxy directives. Apache will
listen, my code intercept the request and respond. 

thanks very much,
Sam