You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modproxy-dev@apache.org by Deliens Christophe <ch...@dad.be> on 2003/03/21 18:34:12 UTC

Calling mod_proxy from a perl script

Hi,
 
I have a perl script which needs to "use" mod_proxy under Apache 2.
 
What I have right now is :
 
   $r->proxyreq(1);
   $r->uri($url);
   $r->filename("proxy:$url");
   $r->handler('proxy-server');
   return Apache::OK;

But it doesn't seem to call the mod_proxy after that... 
 
Any idea why it doesn't? 
 
Thx!
Chris

Re: Calling mod_proxy from a perl script

Posted by Ian Holsman <Ia...@cnet.com>.
Deliens Christophe wrote:
> Hi,
>  
> I have a perl script which needs to "use" mod_proxy under Apache 2.
>  
> What I have right now is :
>  
>    $r->proxyreq(1);
>    $r->uri($url);
>    $r->filename("proxy:$url");
>    $r->handler('proxy-server');
>    return Apache::OK;
> But it doesn't seem to call the mod_proxy after that...
>  
> Any idea why it doesn't?
>  
> Thx!
> Chris

this is the C code I use to make a request into a reverse-proxied one. (slightly edited)
    if (isDynamic == 1)  {
             const char *szApp= "http://foobar";

             r->filename = apr_pstrcat(r->pool,"proxy:",  szApp, r->uri, NULL);
             r->handler = "proxy-server";
             r->proxyreq = PROXYREQ_REVERSE;
             r->filename=pNewURL;
     }
and it works ok for me.