You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Radoslaw Zielinski <ra...@pld-linux.org> on 2006/12/12 18:54:51 UTC

Re: MODPERL and Reverse Proxy [patch]

Jonathan Vanasco <mo...@2xlp.com> [08-12-2006 21:50]:
> On Dec 7, 2006, at 3:37 PM, Sumit Shah wrote:
>> I want the request to come to My::RequestHandler FIRST and then go  
>> to the ProxyPass Directive. It does not do this. It BYPASSES my  

I've been working on something like this recently...

[...]
> So you've got the chance to call a mp hook on  
> PerlPostReadRequestHandler or PerlTransHandler

IIRC (can't check at the moment of writing this) I got it working with
PerlPostReadRequestHandler.

> Unfortunately, for that to happen under the current design of Apache/ 
> ModPerl/and ModProxy, you probably won't have the data you want  
> available ( i believe you only have access to the URI at that phase )

IIRC URI and headers; I haven't tested if POST data is available.

> In order to get what you want done, you'll have to handle the Proxy  
> internally -- ie, write a perl handler that will fetch the page using  
> LWP or something, and then pass that content on.

This would be slow and is not necessary; just implement the ProxyPass
logic in mod_perl and set:

  $r->proxyreq(Apache2::Const::PROXYREQ_REVERSE);

(Note: this constant has value of 2 and isn't mentioned in proxyreq()'s
documentation.  Patch attached.  There might also be something not quite
right with the $r->unparsed_uri description.)

-- 
Radosław Zieliński <ra...@pld-linux.org>