Sunday, May 20, 2018

http configuration to connect different type of backened app server from single virtual host

Leave a Comment

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

e.g. MachineA(https) -> MachineB(http:reverseproxy) -> MachineCn(http: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 ?

1 Answers

Answers 1

I don't know why your ifmodule statement is applied to the whole VirtualHost, why not limit it to only to the rules for weblogic reverse proxy?

Also you didn't close your Location statements, checkout this modified file:

LoadModule weblogic_module   "/u01/oracle/ohssa/ohs/modules/mod_wl_ohs.so" RewriteEngine On RewriteCond %{HTTPS} on RewriteRule ^$ http://%{HTTP_HOST} [L,R]  <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/reactaphome>      ProxyPass  http://admiring_agnesi:8080      ProxyPassReverse  http://admiring_agnesi:8080    </Location>     <Location /pod/tomcatapp>      ProxyPass  http://admiring_agnesi:1337      ProxyPassReverse  http://admiring_agnesi:1337    </Location>     <IfModule mod_weblogic.c>     <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    </IfModule>   </VirtualHost> 

Could you try with that? All the requests to the *:7777 port will be handled.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment