3 Replies Latest reply on Jan 17, 2013 10:31 AM by tehdave

    Apache serving static content while JBoss serves dynamic?

    tehdave

      We're in the process of converting our WebSphere applications to JBoss. Some of our apps serve all of their content, but others use an IBM custom property to tell the plugin to have Apache serve static content assets (.html, .jpg, etc). While researching methods of implementing this in JBoss, I ran across several places suggesting that simply adding a ProxyPassMatch <regex> ! to my Apache conf would take care of it. However, as soon as I add the line:

      ProxyPassMatch ^(.*\.jpg)$ !

       

      nothing gets sent to JBoss at all, where all the dynamic content was working correctly previously. Fortunately, the .jpg file is now served correctly from Apache. Of course, this isn't as helpful as it might otherwise be without the dynamic content functioning.

       

      We're using Apache 2.2.23, mod_cluster 1.2.4.SNAPSHOT-4, amd JBoss EAP6 all on RHEL (5.8 for Apache server, 6.2 for JBoss).

       

      The JBoss config looks like:

       

      domain.xml:

       

      <subsystem xmlns="urn:jboss:domain:modcluster:1.1">

      <mod-cluster-config proxy-list="webhost1:45015,webhost2:45015" balancer="appdev" advertise="false" excluded-contexts="admin-console,invoker,jbossws,jmx-console,juddi,web-console" load-balancing-group="appdev" connector="https">

      <dynamic-load-provider>

      <load-metric type="busyness"/>

      </dynamic-load-provider>

      </mod-cluster-config>

      </subsystem>

       

      Apache Vhost:

       

      <VirtualHost *:7230>

      ServerName someserver.name.com

      CustomLog logs/someserver.name.com.access_log nscombined env=!dontlog

      ErrorLog logs/someserver.name.com.error_log

      KeepAlive On

      SSLEngine On

      SSLCertificateKeyFile ssl/private/someserver.name.com.key

      SSLCertificateFile ssl/certs/someserver.name.com.cert

      RewriteEngine on

      RewriteRule ^/server-status - [PT,L]

      DocumentRoot /path/to/static/content

      DirectoryIndex index.html index.htm index.jsp

      RewriteCond %{HTTP:X-NS-SSL} !=TRUE

      RewriteRule ^/(.*)$ https://someserver.name.com/$1 [R,L]

      ProxyPassMatch ^(.*\.jpg)$ !

      </VirtualHost>

       

      Any suggestions?

        • 1. Re: Apache serving static content while JBoss serves dynamic?
          tehdave

          Some additional detail...

           

          Playing around with the mod_proxy_cluster.c code, the get_route_balancer code tries to loop through the balancers. When ProxyPassMatch is present, the number of balancers is 0, so the loop does nothing and causes the function to return NULL. If ProxyPassMatch is commented out, it finds balancers and runs through the loop normally:

           

           

           

              for (i = 0; i < conf->balancers->nelts; i++, ptr=ptr+sizeb) {

           

          I added a little debugging, and confirmed that conf->balancers->nelts == 0 when the ProxyPassMatch line is present, and is positive (matching the number of balancers I would expect) when it's commented out.

           

          I'm attempting to discover how that balancer list is populated - the mod_cluster-status page seems to show the balancers I would expect, but it seems to use a different method to get its balancer list - but I've had no luck as of yet.

          • 2. Re: Apache serving static content while JBoss serves dynamic?
            rhusar

            What did you configure for CreateBalancers?

              

            http://docs.jboss.org/mod_cluster/1.2.0/html/native.config.html#d0e485

            1 of 1 people found this helpful
            • 3. Re: Apache serving static content while JBoss serves dynamic?
              tehdave

              I just realized I never posted to close out this thread. Thanks for the reply, Radoslav, it led me to the fix. Turned out if you add the ProxyPassMatch with the default CreateBalancers value, it only creates the balancers at the main scope. Once I set it to 0, to create the balancers at the virtualhost level, the scoping was correct and it picked up the ProxyPassMatch directive correctly.