Mohit Anchlia wrote:
[...]

We have a web server that redirects traffic to app server using mod_jk load
balancer.

Now I need to do the following:

1. If request comes from URL /AB and content of URL /AB has content in
certain format then forward it to mod_jk otherwise forward it to some other
URL (external system in our case).

I may be late with this answer, but for the first part above, you may be interested to know that there is an alternative to the "JkMount" directives, like this :

<LocationMatch "/AB">
  SetHandler jakarta-servlet
  SetEnvIf REQUEST_URI "\.(htm|web|css|gif|jpg|js|html?)$" no-jk
  ...

</LocationMatch>

It's a bit harder to find in the documentation, but it means this :
- the <LocationMatch> allows you to match the URI with a regular expression "a la perl". It has the same effect as <Location>, but is a bit more flexible as to what you can match. - "SetHandler jakarta-servlet" does basically the same as "JkMount", for the <Location> in which it is included. - SetEnvIf (requires the "mod_setenvif" standard Apache module) allows you (between other things) to set/unset variables based on requests characteristics (such as here whether the request URI is for one of the file extensions indicated). - and finally, using this to set the "no-jk" variable has the effect (if the URI matches), to *not* re-direct this request through mod_jk.

All of this together means that :
- if the URI matches /AB, it would normally be re-directed through mod_jk and it's load balancer, to the back-end systems - but, if the request matches the "SetEnvIf", then the no-jk variable will be set - thus, when mod_jk receives the request, it will "decline" it (give it back to Apache saying "it's not for me") - thus Apache will apply to this request any other directives present in the same <Location> section (represented here by "...", but which could be mod_perl handlers etc..)

Does this give you new ideas ?

(You might also want to look up the "JkUnMount" directive.)

Now, let me comment on the way you phrase your request :
>> If request comes from URL /AB and content of URL /AB has content in
>> certain format then ...
(you would like it to go there, else somewhere else)

There is a bit of a problem here, if taken literally. The problem is that in order to know the format of the content, this content must be generated. To generate it, you have to decide which process will generate it, and let it do it. Then based on the content, you want to decide who generates it.
A bit of a chicken-and-egg problem here, no ?
Or by "content" do you just mean the file extension, as it appears in the URI ?


André


---------------------------------------------------------------------
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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to