0

we have the following three tier application configuration:

1) Elastic Load Balancer as entry point

2) Two Apache webservers as proxies and load balancers (two for failover) behind the ELB. The webservers have some configuration, that is impossible to make with the ELB alone.

3) Behind the webservers are two application servers (Tomcats with the Liferay application) in a working failover cluster

4) Behind the app servers is the MySQL DB

All this works just fine!

Now: We would like to install the OmniDB application on the application servers (3) and use the Apache webservers (2) to proxy it "to the outside world" (company intranet in this case). OmniDB is needed to present the MySQL DB in a webfrontend GUI, so nobody has to login on the servers directly. More info on OmniDB here

The OmniDB application has one special particularity: It uses/needs two ports and the proxy in front of OmniDB should forward the requests to both of the ports - more info on this topic here

So I have two aplications servers (192.168.1.70 .71) and each of these have the following active web applications:

Tomcat app-server on AJP port 8009 OmniDB web-server on port TCP/8000 OmniDB web-socket on port TCP/25482

Now I would like to acces all this from a frontend apache webservers (192.168.1.68 .69) (or the ELB in front of the webservers in this case).

The tomcat application should be accessible over the default address, like:

https://my-liferay-app.com

And the OmniDB service should be accessible over:

https://my-liferay-app.com/omnidb

Here is my Apache configuration:

<VirtualHost *:8080>
ProxyRequests     Off
ProxyPreserveHost On
RewriteEngine     On
TraceEnable       Off

<Directory /data0/software/apache2/htdocs>
  Options -Indexes -FollowSymLinks
  AllowOverride None
  Order allow,deny
  allow from all
</Directory>

<Proxy balancer://liferaycluster>
    BalancerMember ajp://192.168.1.70:8009 route=node1 ping=5 loadfactor=1
    BalancerMember ajp://192.168.1.71:8009 route=node2 ping=5 loadfactor=1
    ProxySet stickysession=ROUTEID
    ProxySet lbmethod=byrequests
</Proxy>

<Proxy balancer://omnidbcluster>
    BalancerMember http://192.168.1.70:8000 route=node1 ping=5 loadfactor=1
    BalancerMember http://192.168.1.71:8000 route=node2 ping=5 loadfactor=1
    ProxySet stickysession=ROUTEID
    ProxySet lbmethod=byrequests
</Proxy>

<Proxy balancer://omnidbwsscluster>
    BalancerMember http://192.168.1.70:25482 route=node1 ping=5 loadfactor=1
    BalancerMember http://192.168.1.71:25482 route=node2 ping=5 loadfactor=1
    ProxySet stickysession=ROUTEID
    ProxySet lbmethod=byrequests
</Proxy>

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
Header set X-Frame-Options SAMEORIGIN
ProxyPass        /error/ !
ProxyPass        /ErrorPages/ !
ProxyPass        /sitemap.xml !
ProxyPass        /robots.txt !
ProxyPass        /server-status !
ProxyPass        /balancer-manager !

ProxyPass        / balancer://liferaycluster/
ProxyPassReverse / balancer://liferaycluster/

ProxyPass        /omnidb/ balancer://omnidbcluster/
ProxyPassReverse /omnidb/ balancer://omnidbcluster/
ProxyPass        /omnidb/ balancer://omnidbwsscluster/wss
ProxyPassReverse /omnidb/ balancer://omnidbwsscluster/wss

RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
Header set Strict-Transport-Security "max-age=31536000"

<Location />
    AllowOverride None
    Order allow,deny
    Allow from all
    AllowMethods GET POST
</Location>

#ELB IP range:
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 100.125.0.0/16
</VirtualHost>

The liferay application works just fine! But I can't access the additional OmniDB service, because in the current configuration the apache redirects all traffic to the Liferay application.

I'd like to acces my OmniDB service over /omnidb in my-liferay-app.com/omnidb so all requests to ../omnidb should be redirected to ports 8000 and 25482 on the same application servers. As I said, I have two application servers for failover purposes, so a simple proxy won't work here. The Apaches have to work as load balancers - that's why I have LB directives in my httpd.conf

Currently all requests (also these for ../omnidb) are routed to the Tomcat application and it responds with 404, which is correct. I'd like to access the ports 8000 + 25482 on the application servers, when I open the ../omnidb address on my server.

How do I do it? I'm relatively new to the Apache web server, so I'm struggling here... If a rewrite rule on the Apache is needed here, then I kindly ask somebody to deliver the complete code for it.

Thank you all kindly in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.