2 Replies Latest reply on Mar 13, 2016 11:52 PM by Lavin Korukanti

    apache mod_rewrite with mod_cluster to EAP

    Lavin Korukanti Newbie

      Hello All,

       

      We are having jboss web server 3.0.2 (apache2.4) and application server JBOSS EAP 6.2 , I am trying to achieve the below requirement

       

      a) internal user enters https://example.com/abc-ui , it should redirect calls to application abc with context root (/abc-ui) hosted on an EAP Cluster A

       

      b) internal user enters https://example.com/def-ui, it should redirect calls to application def with context root (/def-ui) hosted on the EAP Cluster A

       

      c) external users enter https://example.com/client/cef , it should redirect  calls to application abc with context root (/abc-ui) hosed on EAP Cluster A

       

      d) external users enter https://example.com/client/tal , it should redirect calls to liferay portal application with context root ( ROOT Context root) hosted on the EAP Cluster B

       

      I was able to  do a & b, and if user clicks https://example.com/ it works properly to redirect to liferay portal

       

       

      but i am struggling to make c & d work , Can some one please guide me

       

      i have put the below configurations in my apache httpd.conf file

       

       

      <IfModule manager_module>

       

          Listen 7080

          LogLevel info

          RewriteRule ^/abc-u(.*)$ balancer://clusterA/abc-ui$1 [PT,L]

          RewriteRule ^/def-u(.*)$ balancer://ClusterA/def-ui$1 [PT,L]

          RewriteRule ^/(.*)$ balancer://ClusterB/$1 [PT,L]

          <VirtualHost *:7080>

              KeepAliveTimeout 60

              MaxKeepAliveRequests 0

              EnableMCPMReceive on

              ServerAdvertise off

              AdvertiseFrequency 5

              <Directory />

                  Order deny,allow

                  Require all granted

              </Directory>

              <Location /mod_cluster-manager>

                  SetHandler mod_cluster-manager

                  Order deny,allow

                  Require all granted

              </Location>

          </VirtualHost>

       

      </IfModule>

        • 1. Re: apache mod_rewrite with mod_cluster to EAP
          Jean-Frederic Clere Master

          c) that isn't going to work with mod_cluster you need that context to be the same (/client/cef) can't go to /abc-ui)

          d) same kind of problem.

           

          Probably you should use mod_proxy_balancer instead mod_cluster for such rewrite.

          • 2. Re: apache mod_rewrite with mod_cluster to EAP
            Lavin Korukanti Newbie

            Thank you for your inputs , I have changed the context root of my liferay application to /lportal  from root context-root and have written the below in my http.conf ,

             

            My Apache is Listening on 7200 and with the below I am successfully able to achieve all of my above conditions except the only issue I have is now is

             

            if user enters https://example.com/client/cef it is throwing 404 errors , and it works good when user enters https://example.com/client/cef/

             

            I am struggling to add that trailing slash after cef , Can you please help

             

            <VirtualHost *:7200>
                RewriteEngine On
               RewriteRule ^/client/cef/(.*)$ /abc-u/$1 [PT,L]
               RewriteRule ^/client/tal(.*)$ /lportal/$1 [PT,L]
            </VirtualHost>

            LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
            LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
            LoadModule manager_module modules/mod_manager.so
            LoadModule advertise_module modules/mod_advertise.so

            MemManagerFile "/weblogs/HTTPServerAptpDevCONINT/cache/mod_cluster"

            <IfModule manager_module>

                Listen 7080

                LogLevel info

                RewriteRule ^/abc-u/(.*)$ balancer://clusterA/abc-ui/$1 [PT,L]

                RewriteRule ^/def-u/(.*)$ balancer://ClusterA/def-ui/$1 [PT,L]

                RewriteRule ^/lportal/(.*)$ balancer://ClusterB/$1 [PT,L]

                <VirtualHost *:7080>

                    KeepAliveTimeout 60

                    MaxKeepAliveRequests 0

                    EnableMCPMReceive on

                    ServerAdvertise off

                    AdvertiseFrequency 5

                    <Directory />

                        Order deny,allow

                        Require all granted

                    </Directory>

                    <Location /mod_cluster-manager>

                        SetHandler mod_cluster-manager

                        Order deny,allow

                        Require all granted

                    </Location>

                </VirtualHost>

             

            </IfModule>