You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Greg Allen <ga...@mycalet.com> on 2011/04/03 19:37:47 UTC

[users@httpd] mod_rewrite and mod_jk

I am trying to use mod_rewrite to rewrite URLs coming into my server and 
have the resulting value from mod_rewrite processed by mod_jk.  Here's 
the relevant section of my httpd.conf file:

<VirtualHost 127.0.0.1:80>
DocumentRoot /home/webadmin/localhost/html
SuexecUserGroup webadmin webadmin
ServerAdmin "webadmin@locahost"
ScriptAlias "/cgi-bin/" "/home/webadmin/localhost/cgi-bin/"
CustomLog "/home/webadmin/localhost/access_log" "combined"
ErrorLog "/home/webadmin/localhost/error_log"

RewriteEngine on
RewriteLog /tmp/rewrite.log
RewriteLogLevel 9
RewriteMap map prg:/tmp/rewrite.pl
RewriteRule (.*) ${map:$1} [PT]

JkMount /tomcat/* ajp13

LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog "/home/webadmin/localhost/deflate_log" deflate

<Directory /home/webadmin/localhost/html>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

Take this PROFIND request for example: http://localhost/anything/

It comes in and the mapping routine returns /tomcat/.  I would expect 
this to match the JkMount and be forwarded to Tomcat.  That doesn't seem 
to be happening.  You can see the request in my access_log file:

127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ 
HTTP/1.1" 401 954 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); 
iPhone/3.1.2 7D11"
127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ 
HTTP/1.1" 207 1077 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); 
iPhone/3.1.2 7D11"
127.0.0.1 - - [03/Apr/2011:12:33:01 -0400] "PROPFIND / HTTP/1.1" 405 325 
"-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"

It looks odd. I'm not sure why the first one gets a 401, but the second 
one succeeds (all from my one initial request).  It doesn't appear that 
anything gets forwarded on to tomcat either - I can't find anything in 
any of the tomcat logs that the request was ever sent.

Is what I am trying to do even possible?  If so, what is wrong? I've 
been reading the mod_rewrite and apache docs and can't find anything.

Thanks,

-- Greg


---------------------------------------------------------------------
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


Re: [users@httpd] mod_rewrite and mod_jk

Posted by Dirk Schaare <di...@schaare.net>.
Greg,

I don't know exactly what happens within that rewrite.pl, but what makes me feel curious was the "ajp13" as your JkMount target. My workers.properties file looks pretty different:

# list of workers                                                                                                    
worker.list=MyWorker,jkstatus                                                                                        
                                                                                                                        
# Basic setting to be referenced in all workers                                                                      
worker.basic.type=ajp13                                                                                                 
worker.basic.port=8009                                                                                                  
worker.basic.lbfactor=1                                                                                                 
                                                                                                                        
# Set properties for MyWorker                                                                                           
worker.MyWorker.reference=worker.basic                                                                              
worker.MyWorker.host=localhost

accordingly the directive in the Apache configuration would look like this:

JkMount /MyWebApp/* MyWorker

and if I want to use the status page:

        <Location /jkmanager/>                                                                                          
            JkMount jkstatus                                                                                            
            Order deny,allow                                                                                            
            Deny from all                                                                                               
            Allow from localhost                                                                                              
        </Location>

Maybe I missed the latest mod_jk changes, but your worker.properties file is very different from what I found in the official docs: http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

> It seems to work fine. Those URLs do end up being handled by tomcat.

Oops, from your first post it reads like nothing is forwarded to Tomcat - so I'm on the wrong track?

Cheers,
Dirk  

On 03.04.2011, at 22:03, Greg Allen wrote:

> My workers.properties file:
> 
> [channel.socket:localhost:8009]
> port=8009
> host=127.0.0.1
> 
> [ajp13:localhost:8009]
> channel=channel.socket:localhost:8009
> 
> Why does the JkMount look "unusual" to you?  Just the "tomcat"?  That's just
> a URL I am using for my testing.  My understanding is that anything URL with
> the prefix "/tomcat/*" will be passed to tomcat.
> 
> It seems to work fine. Those URLs do end up being handled by tomcat.
> 
> -- Greg
> 
> On 4/3/2011 3:42 PM, Dirk Schaare wrote:
>> what about your workers.properties file?
>> 
>>> JkMount /tomcat/* ajp13
>> looks pretty unusual to me
>> 
>> Cheers,
>> Dirk
>> 
>> On 03.04.2011, at 19:37, Greg Allen wrote:
>> 
>>> I am trying to use mod_rewrite to rewrite URLs coming into my server and have the resulting value from mod_rewrite processed by mod_jk.  Here's the relevant section of my httpd.conf file:
>>> 
>>> <VirtualHost 127.0.0.1:80>
>>> DocumentRoot /home/webadmin/localhost/html
>>> SuexecUserGroup webadmin webadmin
>>> ServerAdmin "webadmin@locahost"
>>> ScriptAlias "/cgi-bin/" "/home/webadmin/localhost/cgi-bin/"
>>> CustomLog "/home/webadmin/localhost/access_log" "combined"
>>> ErrorLog "/home/webadmin/localhost/error_log"
>>> 
>>> RewriteEngine on
>>> RewriteLog /tmp/rewrite.log
>>> RewriteLogLevel 9
>>> RewriteMap map prg:/tmp/rewrite.pl
>>> RewriteRule (.*) ${map:$1} [PT]
>>> 
>>> JkMount /tomcat/* ajp13
>>> 
>>> LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
>>> CustomLog "/home/webadmin/localhost/deflate_log" deflate
>>> 
>>> <Directory /home/webadmin/localhost/html>
>>> Options Includes FollowSymLinks
>>> AllowOverride All
>>> </Directory>
>>> </VirtualHost>
>>> 
>>> Take this PROFIND request for example: http://localhost/anything/
>>> 
>>> It comes in and the mapping routine returns /tomcat/.  I would expect this to match the JkMount and be forwarded to Tomcat.  That doesn't seem to be happening.  You can see the request in my access_log file:
>>> 
>>> 127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ HTTP/1.1" 401 954 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
>>> 127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ HTTP/1.1" 207 1077 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
>>> 127.0.0.1 - - [03/Apr/2011:12:33:01 -0400] "PROPFIND / HTTP/1.1" 405 325 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
>>> 
>>> It looks odd. I'm not sure why the first one gets a 401, but the second one succeeds (all from my one initial request).  It doesn't appear that anything gets forwarded on to tomcat either - I can't find anything in any of the tomcat logs that the request was ever sent.
>>> 
>>> Is what I am trying to do even possible?  If so, what is wrong? I've been reading the mod_rewrite and apache docs and can't find anything.
>>> 
>>> Thanks,
>>> 
>>> -- Greg
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> 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
>>> 
> 
> -- 
> Greg Allen
> Calet, LLC
> gallen@mycalet.com
> 
> 
> ---------------------------------------------------------------------
> 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
> 


Re: [users@httpd] mod_rewrite and mod_jk

Posted by Greg Allen <ga...@mycalet.com>.
My workers.properties file:

[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

Why does the JkMount look "unusual" to you?  Just the "tomcat"?  That's just
a URL I am using for my testing.  My understanding is that anything URL with
the prefix "/tomcat/*" will be passed to tomcat.

It seems to work fine. Those URLs do end up being handled by tomcat.

-- Greg

On 4/3/2011 3:42 PM, Dirk Schaare wrote:
> what about your workers.properties file?
>
>> JkMount /tomcat/* ajp13
> looks pretty unusual to me
>
> Cheers,
> Dirk
>
> On 03.04.2011, at 19:37, Greg Allen wrote:
>
>> I am trying to use mod_rewrite to rewrite URLs coming into my server and have the resulting value from mod_rewrite processed by mod_jk.  Here's the relevant section of my httpd.conf file:
>>
>> <VirtualHost 127.0.0.1:80>
>> DocumentRoot /home/webadmin/localhost/html
>> SuexecUserGroup webadmin webadmin
>> ServerAdmin "webadmin@locahost"
>> ScriptAlias "/cgi-bin/" "/home/webadmin/localhost/cgi-bin/"
>> CustomLog "/home/webadmin/localhost/access_log" "combined"
>> ErrorLog "/home/webadmin/localhost/error_log"
>>
>> RewriteEngine on
>> RewriteLog /tmp/rewrite.log
>> RewriteLogLevel 9
>> RewriteMap map prg:/tmp/rewrite.pl
>> RewriteRule (.*) ${map:$1} [PT]
>>
>> JkMount /tomcat/* ajp13
>>
>> LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
>> CustomLog "/home/webadmin/localhost/deflate_log" deflate
>>
>> <Directory /home/webadmin/localhost/html>
>> Options Includes FollowSymLinks
>> AllowOverride All
>> </Directory>
>> </VirtualHost>
>>
>> Take this PROFIND request for example: http://localhost/anything/
>>
>> It comes in and the mapping routine returns /tomcat/.  I would expect this to match the JkMount and be forwarded to Tomcat.  That doesn't seem to be happening.  You can see the request in my access_log file:
>>
>> 127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ HTTP/1.1" 401 954 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
>> 127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ HTTP/1.1" 207 1077 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
>> 127.0.0.1 - - [03/Apr/2011:12:33:01 -0400] "PROPFIND / HTTP/1.1" 405 325 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
>>
>> It looks odd. I'm not sure why the first one gets a 401, but the second one succeeds (all from my one initial request).  It doesn't appear that anything gets forwarded on to tomcat either - I can't find anything in any of the tomcat logs that the request was ever sent.
>>
>> Is what I am trying to do even possible?  If so, what is wrong? I've been reading the mod_rewrite and apache docs and can't find anything.
>>
>> Thanks,
>>
>> -- Greg
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>

-- 
Greg Allen
Calet, LLC
gallen@mycalet.com


---------------------------------------------------------------------
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


Re: [users@httpd] mod_rewrite and mod_jk

Posted by Dirk Schaare <di...@schaare.net>.
what about your workers.properties file?

> JkMount /tomcat/* ajp13

looks pretty unusual to me

Cheers,
Dirk

On 03.04.2011, at 19:37, Greg Allen wrote:

> I am trying to use mod_rewrite to rewrite URLs coming into my server and have the resulting value from mod_rewrite processed by mod_jk.  Here's the relevant section of my httpd.conf file:
> 
> <VirtualHost 127.0.0.1:80>
> DocumentRoot /home/webadmin/localhost/html
> SuexecUserGroup webadmin webadmin
> ServerAdmin "webadmin@locahost"
> ScriptAlias "/cgi-bin/" "/home/webadmin/localhost/cgi-bin/"
> CustomLog "/home/webadmin/localhost/access_log" "combined"
> ErrorLog "/home/webadmin/localhost/error_log"
> 
> RewriteEngine on
> RewriteLog /tmp/rewrite.log
> RewriteLogLevel 9
> RewriteMap map prg:/tmp/rewrite.pl
> RewriteRule (.*) ${map:$1} [PT]
> 
> JkMount /tomcat/* ajp13
> 
> LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
> CustomLog "/home/webadmin/localhost/deflate_log" deflate
> 
> <Directory /home/webadmin/localhost/html>
> Options Includes FollowSymLinks
> AllowOverride All
> </Directory>
> </VirtualHost>
> 
> Take this PROFIND request for example: http://localhost/anything/
> 
> It comes in and the mapping routine returns /tomcat/.  I would expect this to match the JkMount and be forwarded to Tomcat.  That doesn't seem to be happening.  You can see the request in my access_log file:
> 
> 127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ HTTP/1.1" 401 954 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
> 127.0.0.1 - - [03/Apr/2011:12:33:00 -0400] "PROPFIND /anything/ HTTP/1.1" 207 1077 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
> 127.0.0.1 - - [03/Apr/2011:12:33:01 -0400] "PROPFIND / HTTP/1.1" 405 325 "-" "DAVKit/4.0 (728.4); iCalendar/1 (42.1); iPhone/3.1.2 7D11"
> 
> It looks odd. I'm not sure why the first one gets a 401, but the second one succeeds (all from my one initial request).  It doesn't appear that anything gets forwarded on to tomcat either - I can't find anything in any of the tomcat logs that the request was ever sent.
> 
> Is what I am trying to do even possible?  If so, what is wrong? I've been reading the mod_rewrite and apache docs and can't find anything.
> 
> Thanks,
> 
> -- Greg
> 
> 
> ---------------------------------------------------------------------
> 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
>