httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: [users@httpd] Mod-jk worker not being called after calling handler
Date Wed, 01 Dec 2010 12:46:20 GMT
On 23.11.2010 18:58, Mohit Anchlia wrote:
> On Mon, Nov 22, 2010 at 4:16 PM, Mohit Anchlia<mohitanchlia@gmail.com>  wrote:
>> On Mon, Nov 22, 2010 at 9:54 AM, Mohit Anchlia<mohitanchlia@gmail.com>  wrote:
>>> On Sat, Nov 20, 2010 at 3:05 AM, Eric Covener<covener@gmail.com>  wrote:
>>>> On Sat, Nov 20, 2010 at 12:09 AM, Mohit Anchlia<mohitanchlia@gmail.com>
 wrote:
>>>>> I am trying to look at how handlers work so I created a very simple
>>>>> perl handler that just return "OK". And I added an entry "PerlModule"
>>>>> and the "PerlHandler". I also was able to build mod_perl2.so. When I
>>>>> do a GET request with handler ON I see that Handler gets called but
>>>>> then the call is not going further to the mod-jk worker. Can someone
>>>>> please tell me what might be going on? I thought OK will continue down
>>>>> the cycle.
>>>>
>>>> you have to return DECLINED if you want to let someone else to run
>>>> hooks like handler.
>>>
>>> I tried
>>>
>>> package Apache2::Rules2;
>>> #use lib '/home/.mohit/mod_perl-2.0.4/lib';
>>> use Apache2::Const qw(:common);
>>> use Apache2::RequestRec ();
>>> use Apache2::RequestIO ();
>>> sub handler {
>>> my $r = shift;
>>> #$r->content_type('text/plain');
>>> #$r->print("mod_perl rules!\n");
>>> return DECLINE; # We must return a status to mod_perl
>>> }
>>> 1; # This is a perl module so we must return true to perl
>>>
>>> But even though I am using DECLINE it doesn't continue going to
>>> mod-jk. Handler just becomes the final destination in this case. How
>>> can I write handler such that it continues sending request to mod-jk.
>>>
>>> In virtual host I added this:
>>>
>>>
>>> PerlModule Apache2::Rules2
>>> SetHandler perl-script
>>> PerlHandler Apache2::Rules2
>>> PerlSendHeader On
>>>
>>
>> I now changed it to DECLINED. Now it tries to forward the request but
>> looks like instead of forwarding it to mod-jk worker it is trying to
>> locate document on the same web server.
>>
>>
>> http://ws1/bridge/e?val
>> HTTP request sent, awaiting response... 404 Not Found
>> 16:11:45 ERROR 404: Not Found.
>>
>> In access logs it says e?val not found. It's supposed to forward this
>> request to mod_jk worker. Because bridge is a servlet in jboss app
>> server and apache sends it using mod_jk.
>
> Can someone advise why it's not going to mod_jk? How do I debug this?

There is often some confusion about the words handler and hooks. Of all 
the hooks provided by Apache, the handler responsible for actually 
providing the content of the response (mod_perl: PerlResponseHandler) 
behaves in a special way. If returning DECLINED, Apache will not call 
another such handler but instead return an error message. If a handler 
really wants to let another handler answer the request (which is not 
typical), it needs to invoke an internal_redirect. I don't know whether 
mod_perl supports that.

It is not unlikely that any steps used to prepare the final content 
generation are better to moved to one or several of the numerous other 
hooks.

The use of "PerlHandler" in your configuration suggests, that you should 
read a bit more about how to use mod_perl. That diractive is only there 
for 1.0 compatibility reasons. If you start out something new, you 
shouldn't use it.

Pointers are:

http://perl.apache.org/docs/2.0/user/handlers/intro.html

and

http://perl.apache.org/docs/2.0/user/

in general, as well as

http://modules.apache.org/doc/API.html

Regards,

Rainer


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message