You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2006/07/12 23:36:16 UTC

mod_proxy_ajp with multiple ajp ports

All,

Please forgive me if this question has already been asked. With such a
high volume, searching the archives has been arduous and I haven't found
what I'm looking for.

I'm used to using mod_jk where I can just do this:

JkMount /my/path/*.whatever worker2
JkMount /my/path/*.whatever.else worker3

etc.

Note that I'm using the same path space with different path endings to
switch between two different workers.

Now that I'm using mod_proxy_ajp, I've changed my configuration to
something like this:

ProxyPass /my/path ajp://localhost:8185/my/path

It appears that I cannot do something like this:

ProxyPass /my/path/*.whatever.else ajp://localhost:8285/my/path

... and get a different URL space to map into my /second/ AJP target.

Basically, I've got a regular webapp running on ajp:8185 and Cocoon
running on ajp:8285 and I want to be able to forward/proxy requests
appropriately, regardless of the exact paths. For example, it doesn't
seem reasonable that I should have to add an additional path to my
webapp /just/ for cocoon requests, like this:

ProxyPass /my/path/cocoon-only ajp://localhost:8285/my/path

I have tried all manner of combinations of <Location> (doesn't work
because you can't use the 2-argument ProxyPass in a <Location>),
<LocationMatch>, and others to try to get this to work.

My most promising solution involved using mod_rewrite to introduce a
fake URL space (essentially inserting the "cocoon-only" portion into the
URL), but that does one of two things:

1) Replaces the URL in the browser with one that does not exist,
   so reloads don't work. :(
2) Goes into an infinite loop and never loads the page. :(

So, I'm open to any and all suggestions.

Thank you all /so much/ in advance,
-chris


Re: mod_proxy_ajp with multiple ajp ports

Posted by Bill Barker <wb...@wilshire.com>.
"Pid" <p...@pidster.com> wrote in message news:44B8057D.4070104@pidster.com...
>
>
> Christopher Schultz wrote:
>> Bill,
>>
>> Thanks for the response.
>>
>>> I've seen some talk on dev@httpd about implementing support for
>>> regexps in mod_proxy, but I don't think anything has happened yet.
>>
>> It doesn't appear to be a question of regular expressions, since the
>> <Location> element can use regular expressions. The problem is that,
>> when those regular expressions are used, it clobbers the URL for
>> proxying, and the proxy attempts to use the wrong source URL (or 
>> something).
>>
>>> What you want is something like:
>>>   RewriteRule /my/path/.*\.whatever\.else
>>> ajp://localhost:8285/my/path/$1.whatever.else [P]
>>
>> For whatever reason, this does not work on its own. I figured that I
>> could do something like this:
>>
>> RewriteRule /myApp/some/special.url \
>>             ajp://localhost:8285/myApp/special.url [P]
>> RewriteRule /myApp/(.*) \
>>             ajp://localhost:8185/myApp/$1 [P]
>>
>> ...but that's not enough. You have to mix both RewriteRule /and/
>
>> ProxyPass to achieve the desired result:
>>
>> RewriteRule /myApp/some/special.url \
>>             ajp://localhost:8285/myApp/special.url [P]
>> ProxyPass /myApp ajp://localhost:8185/myApp
>
> AFAIK you can only use the ProxyPass directive to set the additional
> configuration parameters (lb type etc).
>
> I've used a single long none-existent URL to do that where needed, and
> just used the ReWrite rule to parse the URLs.
>

This is right, if you haven't configured the worker in a
   <Proxy balancer://mycluster>
        BalancerMember ajp://localhost:8285
   </Proxy>
Otherwise, yeah, just use a non-existent URL in the ProxyPass directive. 
You might also consider writing up a bug report for the Httpd BZ.
>
>> My best guess is that Apache requires the ProxyPass directive in there
>> so that my virtual host gets configured to use mox_proxy /at all/. I'd
>> imagine that I could have as many RewriteRules as I needed, as long as
>> that one ProxyPass directive is in there.
>>
>> Perhaps someone with a better understanding can tell me what's really
>> going on.
>>
>> For now, I'm happy since it appears to work exactly as desired.
>>
>> Thanks a lot for the help!
>>
>> -chris
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 




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


Re: mod_proxy_ajp with multiple ajp ports

Posted by Pid <p...@pidster.com>.

Christopher Schultz wrote:
> Bill,
> 
> Thanks for the response.
> 
>> I've seen some talk on dev@httpd about implementing support for 
>> regexps in mod_proxy, but I don't think anything has happened yet.
> 
> It doesn't appear to be a question of regular expressions, since the
> <Location> element can use regular expressions. The problem is that,
> when those regular expressions are used, it clobbers the URL for
> proxying, and the proxy attempts to use the wrong source URL (or something).
> 
>> What you want is something like:
>>   RewriteRule /my/path/.*\.whatever\.else 
>> ajp://localhost:8285/my/path/$1.whatever.else [P]
> 
> For whatever reason, this does not work on its own. I figured that I
> could do something like this:
> 
> RewriteRule /myApp/some/special.url \
>             ajp://localhost:8285/myApp/special.url [P]
> RewriteRule /myApp/(.*) \
>             ajp://localhost:8185/myApp/$1 [P]
> 
> ...but that's not enough. You have to mix both RewriteRule /and/

> ProxyPass to achieve the desired result:
> 
> RewriteRule /myApp/some/special.url \
>             ajp://localhost:8285/myApp/special.url [P]
> ProxyPass /myApp ajp://localhost:8185/myApp

AFAIK you can only use the ProxyPass directive to set the additional
configuration parameters (lb type etc).

I've used a single long none-existent URL to do that where needed, and
just used the ReWrite rule to parse the URLs.


> My best guess is that Apache requires the ProxyPass directive in there
> so that my virtual host gets configured to use mox_proxy /at all/. I'd
> imagine that I could have as many RewriteRules as I needed, as long as
> that one ProxyPass directive is in there.
> 
> Perhaps someone with a better understanding can tell me what's really
> going on.
> 
> For now, I'm happy since it appears to work exactly as desired.
> 
> Thanks a lot for the help!
> 
> -chris
> 

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


Re: mod_proxy_ajp with multiple ajp ports

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Bill,

Thanks for the response.

> I've seen some talk on dev@httpd about implementing support for 
> regexps in mod_proxy, but I don't think anything has happened yet.

It doesn't appear to be a question of regular expressions, since the
<Location> element can use regular expressions. The problem is that,
when those regular expressions are used, it clobbers the URL for
proxying, and the proxy attempts to use the wrong source URL (or something).

> What you want is something like:
>   RewriteRule /my/path/.*\.whatever\.else 
> ajp://localhost:8285/my/path/$1.whatever.else [P]

For whatever reason, this does not work on its own. I figured that I
could do something like this:

RewriteRule /myApp/some/special.url \
            ajp://localhost:8285/myApp/special.url [P]
RewriteRule /myApp/(.*) \
            ajp://localhost:8185/myApp/$1 [P]

...but that's not enough. You have to mix both RewriteRule /and/
ProxyPass to achieve the desired result:

RewriteRule /myApp/some/special.url \
            ajp://localhost:8285/myApp/special.url [P]
ProxyPass /myApp ajp://localhost:8185/myApp


My best guess is that Apache requires the ProxyPass directive in there
so that my virtual host gets configured to use mox_proxy /at all/. I'd
imagine that I could have as many RewriteRules as I needed, as long as
that one ProxyPass directive is in there.

Perhaps someone with a better understanding can tell me what's really
going on.

For now, I'm happy since it appears to work exactly as desired.

Thanks a lot for the help!

-chris


Re: mod_proxy_ajp with multiple ajp ports

Posted by Bill Barker <wb...@wilshire.com>.
I've seen some talk on dev@httpd about implementing support for regexps in 
mod_proxy, but I don't think anything has happened yet.

What you want is something like:
  RewriteRule /my/path/.*\.whatever\.else 
ajp://localhost:8285/my/path/$1.whatever.else [P]
Check the documentation for mod_rewrite for more details.

"Christopher Schultz" <ch...@christopherschultz.net> wrote in message 
news:44B56B50.4060900@christopherschultz.net...
All,

Please forgive me if this question has already been asked. With such a
high volume, searching the archives has been arduous and I haven't found
what I'm looking for.

I'm used to using mod_jk where I can just do this:

JkMount /my/path/*.whatever worker2
JkMount /my/path/*.whatever.else worker3

etc.

Note that I'm using the same path space with different path endings to
switch between two different workers.

Now that I'm using mod_proxy_ajp, I've changed my configuration to
something like this:

ProxyPass /my/path ajp://localhost:8185/my/path

It appears that I cannot do something like this:

ProxyPass /my/path/*.whatever.else ajp://localhost:8285/my/path

... and get a different URL space to map into my /second/ AJP target.

Basically, I've got a regular webapp running on ajp:8185 and Cocoon
running on ajp:8285 and I want to be able to forward/proxy requests
appropriately, regardless of the exact paths. For example, it doesn't
seem reasonable that I should have to add an additional path to my
webapp /just/ for cocoon requests, like this:

ProxyPass /my/path/cocoon-only ajp://localhost:8285/my/path

I have tried all manner of combinations of <Location> (doesn't work
because you can't use the 2-argument ProxyPass in a <Location>),
<LocationMatch>, and others to try to get this to work.

My most promising solution involved using mod_rewrite to introduce a
fake URL space (essentially inserting the "cocoon-only" portion into the
URL), but that does one of two things:

1) Replaces the URL in the browser with one that does not exist,
   so reloads don't work. :(
2) Goes into an infinite loop and never loads the page. :(

So, I'm open to any and all suggestions.

Thank you all /so much/ in advance,
-chris





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