0

I have a apache http server that acts as proxy to connect to backened app servers.

e.g. MachineA(https) -> MachineB(reverseproxy) -> MachineCn(App)

Here MachineA(Public_lb) port 9002 is mapped with MachineB(internal apache) port 7777.

In backened, I have different application servers running

for e.g.

  1. MachineC1 -> Weblogic
  2. MachineC2 -> Tomcat
  3. MachineC3 -> NodeJS
  4. MachineC4 -> Flask

Here there is single servername(MachineA: public_facing_lb) and port(9002). Here is my existing configuration in MachineB(apache reverseproxy server)looks like which works fine now for all weblogic connections. But when I add the proxy for other apps, it never works properly.

What I am doing wrong here ?

LoadModule weblogic_module   "/u01/oracle/ohssa/ohs/modules/mod_wl_ohs.so"

RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteRule ^$ http://%{HTTP_HOST} [L,R]



    <IfModule mod_weblogic.c>
       NameVirtualHost *:7777
      <VirtualHost *:7777>
        ServerName https://public_facing_lb:9002
        RewriteEngine       On
        RewriteOptions inherit
        RewriteRule ^/$ /pod/reactaphome [PT]
        Debug ALL
        MatchExpression /
        DebugConfigInfo ON
        WLLogFile /var/log/httpd/wlproxy-qa.log
        KeepAliveEnabled ON
        KeepAliveSecs  15
        WLProxySSLPassThrough ON
        ProxyPreserveHost On


     <Location /pod/reactapp1>
       ProxyPass  http://nodejssrv1:1337
       ProxyPassReverse  http://nodejssrv1:1337
     </Location>

     <Location /pod/flaskapp1>
       ProxyPass  http://flasksrv1:8080
       ProxyPassReverse  http://flasksrv1:8080
     </Location>

     <Location /pod/tomcatapp1>
       ProxyPass  http://tomcatsrv1:8080
       ProxyPassReverse  http://tomcatsrv1:8080
     </Location>

     <Location /pod/console>
        SetHandler weblogic-handler
        WebLogicHost wlssrv1
        WeblogicPort 7001
        WLSRequest On
        ProxyPass  http://wlssrv1:7001/console
        ProxyPassReverse http://wlssrv1:7001/console
     </Location>
        SetHandler weblogic-handler
        WebLogicHost wlssrv1
        WeblogicPort 7001
        ProxyPass /pod/wlsapp1 http://wlssrv1:7001/wlsapp1
        ProxyPassReverse /pod/wlsapp1 http://wlssrv1:7001/wlsapp1
        ProxyPass /pod/wlsapp2 http://wlssrv1:7001/wlsapp2
        ProxyPassReverse /pod/wlsapp2 http://wlssrv1:7001/wlsapp2
        ProxyPass /pod/wlsapp3 http://wlssrv1:7001/wlsapp3
        ProxyPassReverse /pod/wlsapp3 http://wlssrv1:7001/wlsapp3

        ProxyPass /wlsapphome/global http://wlssrv1:7001/resources/getGlobalAppsList
        ProxyPassReverse /wlsapphome/global http://wlssrv1:7001/resources/getGlobalAppsList
        ProxyPass /wlsapphome http://wlssrv1:7001/resources/getAppsList
        ProxyPassReverse /wlsapphome http://wlssrv1:7001/resources/getAppsList

     </VirtualHost>
    </IfModule> 

I might be doing mistake in putting the other app config inside the weblogic if module. If I am creating multiple virtual hosts, at any point of time only the first virtualhost works.

Do I need to load modules for tomcat, nodejs and flask to communicate, as the pages get loaded broken. Like mod_wl_ohs used for weblogic ?

3
  • When you say "doesn't work", what does that mean? What error do you get, what do the logs say?
    – Jenny D
    May 18, 2018 at 19:06
  • @JennyD , I get no logs recorded in http, but it throws 502 bad gateway, with above config. If I remove the location directive of tomcat, flask & nodejs, then page opens for all web-logic connections.
    – kumarprd
    May 18, 2018 at 19:24
  • @JennyD The broken pages get loaded with missing content.
    – kumarprd
    May 18, 2018 at 20:05

1 Answer 1

0

Your <Location> isn't properly closed, hence probably Apache is not even starting properly. Use </Location> to close.

For the "at any point of time only the first virtualhost works" problem, make sure that you specify:

 NameVirtualHost *:7777

before

 <VirtualHost *:7777>

And change the ServerName to be different in each virtual host (for example appname.example.com).

8
  • The ServerName is the loadbalancer DNS name which is fixed
    – kumarprd
    May 18, 2018 at 19:36
  • Thank you for pointing out the </location> close mistake, It was a typing mistake in question. Actually after correcting it , it only loads the title of the page for nodejs application and never load the html page.
    – kumarprd
    May 18, 2018 at 19:38
  • If I am changing the ServerName to different dns name like appname.example.com , then while accesing the url https://https://public_facing_lb:9002/pod/appname redirects to http://appname.example.com:9002/appname which never resolves. The LB is not in my control, so I cant do any hostfile changes in it. LB dns with 9002 is only mapped to apache hostname 7777.
    – kumarprd
    May 18, 2018 at 19:50
  • In your specific case you must then stay with a singe VirtualHost clause. How does the nodejs page work if you put it through some other apache proxy?
    – kubanczyk
    May 18, 2018 at 20:10
  • correct. Actually with my above config the nodejs, flask ui pages loaded but all broken and missing contents.
    – kumarprd
    May 18, 2018 at 20:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .