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>

6 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