Calling mod_proxy from a perl script

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2EFD0.1603A990
Content-Type: text/plain

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

------_=_NextPart_001_01C2EFD0.1603A990
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial size=2>I have a perl script
which needs to "use" mod_proxy under Apache 2.</FONT></SPAN></DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial size=2>What I have right
now is :</FONT></SPAN></DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial size=2>  
$r->proxyreq(1);<BR>   $r->uri($url);<BR>  
$r->filename("proxy:$url");<BR>  
$r->handler('proxy-server');</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2>   return Apache::OK;<BR></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=196023117-21032003>But it doesn't seem
to call the mod_proxy after that... </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=196023117-21032003></SPAN></FONT> </DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial size=2>Any idea why it
doesn't? </FONT></SPAN></DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2>Thx!</FONT></SPAN></DIV>
<DIV><SPAN class=196023117-21032003><FONT face=Arial
size=2>Chris</FONT></SPAN></DIV></BODY></HTML>

------_=_NextPart_001_01C2EFD0.1603A990--
Deliens Christophe [ Fr, 21 März 2003 18:34 ] [ ID #12305 ]

Re: Calling mod_proxy from a perl script

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.
Ian Holsman [ Fr, 21 März 2003 19:17 ] [ ID #12306 ]

RE: Calling mod_proxy from a perl script

Cool!

Can you send me your httpd.conf? or maybe just the configuration part of
mod_proxy & your module...
That would be nice!

Thx!
Chris


-----Original Message-----
From: Ian Holsman [mailto:Ian.Holsman [at] cnet.com]
Sent: Friday, March 21, 2003 7:18 PM
To: modproxy-dev [at] apache.org
Subject: Re: Calling mod_proxy from a perl script


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.
Deliens Christophe [ Mo, 24 März 2003 13:54 ] [ ID #12310 ]

Re: Calling mod_proxy from a perl script

I think the reason why mine works & yours doesn't (it's exactly the same code)
is the execution order.

currently my hook is set up as:
static const char * const aszPost[] = { "mod_proxy.c", NULL };

ap_hook_translate_name(hook_name ,NULL,aszPost,APR_HOOK_FIRST);

so it runs just >before< mod-proxy.

also it returns 'OK' (meaning the proxy's translate_name hook doesn't get called)

I can't share the source unfortunatly..

--ian

Deliens Christophe wrote:
> Cool!
>
> Can you send me your httpd.conf? or maybe just the configuration part of
> mod_proxy & your module...
> That would be nice!
>
> Thx!
> Chris
>
>
> -----Original Message-----
> From: Ian Holsman [mailto:Ian.Holsman [at] cnet.com]
> Sent: Friday, March 21, 2003 7:18 PM
> To: modproxy-dev [at] apache.org
> Subject: Re: Calling mod_proxy from a perl script
>
>
> 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.
Ian Holsman [ Mo, 24 März 2003 18:17 ] [ ID #12315 ]

RE: Calling mod_proxy from a perl script

Ok, I found out what the problem was...

I was using "PerlModule" to call my module instead of "PerlTransHandler" =p

Works fine now!

Thx for your help!
Chris.


-----Original Message-----
From: Ian Holsman [mailto:Ian.Holsman [at] cnet.com]
Sent: Monday, March 24, 2003 6:18 PM
To: modproxy-dev [at] apache.org
Subject: Re: Calling mod_proxy from a perl script


I think the reason why mine works & yours doesn't (it's exactly the same
code) is the execution order.

currently my hook is set up as:
static const char * const aszPost[] = { "mod_proxy.c", NULL };

ap_hook_translate_name(hook_name ,NULL,aszPost,APR_HOOK_FIRST);

so it runs just >before< mod-proxy.

also it returns 'OK' (meaning the proxy's translate_name hook doesn't get
called)

I can't share the source unfortunatly..

--ian

Deliens Christophe wrote:
> Cool!
>
> Can you send me your httpd.conf? or maybe just the configuration part
> of mod_proxy & your module... That would be nice!
>
> Thx!
> Chris
>
>
> -----Original Message-----
> From: Ian Holsman [mailto:Ian.Holsman [at] cnet.com]
> Sent: Friday, March 21, 2003 7:18 PM
> To: modproxy-dev [at] apache.org
> Subject: Re: Calling mod_proxy from a perl script
>
>
> 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.
Deliens Christophe [ Di, 25 März 2003 09:30 ] [ ID #12317 ]
Webserver » gmane.comp.apache.mod-proxy » Calling mod_proxy from a perl script

Vorheriges Thema: proxy_ftp : your opinion ? EPSV / PASV and firewalls
Nächstes Thema: CV