Configure Apache with multiple weblogic server instances

I came across a unique situation at work where I needed to configure Apache web server to forward requests to multiple weblogic server instances running on same box but different port numbers. Here is the scenario:

Instance A - http://test_server:7001/App1(Domain I)
Instance B - http://test_server:7003/App2 (Domain II)
Instance C - http://test_server:7005/App3 (Domain III)

I have App1 deployed on instance1 which is running in domain I. Similarly App2 deployed on instance 2, app3 deployed on instance 3. Needless to say all domains running in different ports(non-clustered environment).

Now I would like to configure my Apache to forward request to respective URLs based on what do they type in the URL.

If they type http://test_server/App1 should go to instance A.
If they type http://test_server/App2 should go to instance B.
If they type http://test_server/App3 should go to instance C.

When I use <IfModule> tag with location combination it did not work for me. But when I use <Location> tag for each app/instance in httpd.conf, it worked. Hope this information helps. 

#### for Instance 1/App1
<Location /App1>
       SetHandler weblogic-handler
       WebLogicHost test_server
       WebLogicPort 7001
       WLCookieName cookie1
       DynamicServerList OFF
       MaxPostSize     2048
       Debug ALL
       WLLogFile logs/httpd_proxy1.log
</Location>

#### for Instance2/App2

<Location /App2>
       SetHandler weblogic-handler
       WebLogicHost test_server
       WebLogicPort 7003
       WLCookieName cookie2
       DynamicServerList OFF
       MaxPostSize     2048
       Debug ALL
       WLLogFile logs/httpd_proxy1.log
</Location>


#### for Instance3/App3
<Location /App3>
       SetHandler weblogic-handler
       WebLogicHost test_server
       WebLogicPort 7005
       WLCookieName cookie3
       DynamicServerList OFF
       MaxPostSize     2048
       Debug ALL
       WLLogFile logs/httpd_proxy1.log
</Location>

7 comments:

  1. Thanks for the solution, even I'm having the same setup. But, we are running 4 weblogic instances on the same machine and we need to call these instances through reverse proxy (apache).
    HTTPS ---> Apache ---> HTTP ---> WL
    Any idea on how to implement this.
    Apache : 2.2.3
    WL : 9.2 MP3

    Reverse proxy example
    ProxyPass /console http://dev:7005/console
    ProxyPassReverse /console http://dev:7005/console

    ProxyPass /console http://dev:7015/console
    ProxyPassReverse /console http://dev:7015/console
    Regards,
    Madhu

    ReplyDelete
  2. Could you check Apache documentation?

    ReplyDelete
  3. Hello, if you use this configuration you will be able to do the same also with a single domain and a cluster, but with obviously with different ports.


    KeepAliveEnabled On
    KeepAliveSecs 120
    Idempotent OFF
    WLIOTimeoutSecs 600
    WLLogFile "C:/bea/Apache Fundation/Apache 2.0/Apache2/logs/wlproxy.log"




    SetHandler weblogic-handler
    WebLogicHost machine_1
    WebLogicPort 7101



    SetHandler weblogic-handler
    WebLogicHost machine_1
    WebLogicPort 7101



    SetHandler weblogic-handler
    WebLogicCluster machine_1:7001,machine_2:7001

    ReplyDelete
  4. Hello, if you use this configuration you will be able to do the same also with a single domain and a cluster, but with obviously with different ports.

    <IfModule mod_weblogic.c>

    KeepAliveEnabled On

    KeepAliveSecs 120

    Idempotent OFF

    WLIOTimeoutSecs    600

    WLLogFile "C:/bea/Apache Fundation/Apache 2.0/Apache2/logs/wlproxy.log"

    </IfModule>



    <Location /app1>

           
    SetHandler weblogic-handler

          
     WebLogicHost machine_1

           
    WebLogicPort 7101

    </Location>



    <Location /app2>

           
    SetHandler weblogic-handler

          
     WebLogicHost machine_2

           
    WebLogicPort 7101

    </Location>



    <Location /app3_cluster>

        SetHandler weblogic-handler

       
    WebLogicCluster machine_1:7001,machine_2:7001

    </Location>

    ReplyDelete
  5. Thank you for sharing. Anyway, one more question: which changes should I apply to Tomcat server.xml file, - I mean how to modify jvmRoute option inside of tag ? Thank you.

    ReplyDelete
  6. Oups, my tag was escaped. I meant:
    "how to modify jvmRoute option inside of tag ?"

    ReplyDelete
  7. hi,

    i have a set up for a domain like below:

    2 machines with 2 managed servers each and 2 clusters

    like: machine1 has ms1,ms2 and machine2 has ms3,ms4

    i clustered ,
    ms1 (on machine1)and ms3(on machine2) as cluster1 and ms2(on machine1) and ms4(on machine2) as cluster2

    now my question is how to fwd requests from apache server to these clusters...

    note:both clusters reside on same domain

    i want to know how to configure in httpd.conf file.

    ReplyDelete