How to configure mod_jk inside the <Location> setting with <If> setting on Apache httpd?

Solution Verified - Updated -

Issue

  • How do I configure mod_jk inside the specific <Location> directive with <If> directive on Apache httpd?
  • I would like to separate the forwarding backend server for the specific condition with IP addresses like <If "-R '192.168.1.0/24'">. So, I've tried the following configuration having JkMount inside <Location> with <If>:

    <Location /test/*>
      <If "-R '192.168.1.0/24'">
        JkMount loadbalancer
      </If>
    </Location>
    

    However, Apache httpd/mod_jk did not start due to the syntax error "JkMount context should start with /".
    I've also tried the following configuration:

    <Location /test/*>
      <If "-R '192.168.1.0/24'">
        JkMount /test/* loadbalancer
      </If>
    </Location>
    

    However, Apache httpd/mod_jk still did not start due to the syntax error "JkMount can not have a path when defined in a location".

Environment

  • JBoss Core Services (JBCS)
  • Apache httpd 2.4.51
  • mod_jk 1.2.48

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content