You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mohit Anchlia <mo...@gmail.com> on 2010/11/23 02:34:10 UTC

mod-jk not called after PerlHandler gets called

I posted this thread in mod_perl group:

http://www.gossamer-threads.com/lists/modperl/modperl/102273

I thought I should ask here as well. I have a perl handler in VirtualHost:

JkMount /bridge/* tc

PerlModule Apache2::Rules2
SetHandler modperl
PerlInitHandler Apache2::Rules2
PerlSendHeader On

This Handler just returns DECLINED. After this handler is called the
apache web server tries to find the document on the web server instead
of forwarding it to "JkMount ..." nod-jk worker. I get "404" and in
the access logs of apache I see that it's trying to locate the
document on the same server instead of using JkMount to forward the
request to mod-jk.

How can I make this work? There is nothing online on this topic.

Rules2.pm

package Apache2::Rules2;
#use lib '/home/.mohit/mod_perl-2.0.4/lib';
use strict;
use warnings;
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 DECLINED; # We must return a status to mod_perl
}
1; # This is a perl module so we must return true to perl
~

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod-jk not called after PerlHandler gets called

Posted by André Warnier <aw...@ice-sa.com>.
Mohit Anchlia wrote:
> I posted this thread in mod_perl group:
> 
> http://www.gossamer-threads.com/lists/modperl/modperl/102273
> 
> I thought I should ask here as well. 

Before someone on this list tells you to that you are in the wrong place, let me say a 
word : this question /is/ relevant to this list, in the sense that it implicates mod_jk, 
for which this is the right list.

In fact, Mohit's question involves Apache httpd, mod_jk and mod_perl.

The question here is in fact : given some "JkMount" directives in Apache, and also a 
"setHandler mod_perl", which response handler will Apache select ?
And the confusion is due to the not-so-clear fact that "JkMount" is in fact a "setHandler" 
instruction in disguise.

So, Mohit, the problem is that this :

  > JkMount /bridge/* tc

and this :

> SetHandler modperl

are in "conflict".  The first JkMount is in fact like a

"setHandler mod_jk  IF the URL looks like /bridge/*"

But, a few lines later, you have an unconditional "setHandler mod_perl", which overrides 
this JkMount.

So in the end, the response handler is mod_perl, and mod_jk is "forgotten".

But then, in your mod_perl response handler, you return DECLINED.

That tells Apache that it should look for another response handler.  But mod_jk is already 
forgotten, so Apache finds only its own "default handler", the one which tries to return 
the URL as a file on disk.

Mohit, I believe that for the rest of this discussion, it is better to continue it on the 
mod_perl list, because the rest is not so relevant to mod_jk or Tomcat.

Except that you should first read this page :

http://tomcat.apache.org/connectors-doc/reference/apache.html

and in particular the sections :
Assigning URLs to Tomcat
and
Using SetHandler and Environment Variables



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org