title: How to configure same context applications to use different machines with ModCluster and Wildfly10
body: <p>I'm trying to use ModCluster to load balance some servers. We have one single EAR that need to be load balanced by different DNSs.</p>
  
  <p>We have this scenario. We need to <strong>maintain the same context 'system1'</strong> because of backward compatibility</p>
  
  <ul>
  <li>4 servers for urla.com.br/system1/</li>
  <li>2 servers for urlb.com.br/system1/</li>
  </ul>
  
  <p>Using Wildfly 10.1.0 in domain mode, they are separated by two server groups: <strong>URLA</strong> and <strong>URLB</strong>. They share the same profile (URL-HA) and socket bindings (URL-HA-SOCKET). </p>
  
  <p>I have an Apache with mod_cluster with a minimal configuration. </p>
  
  <pre><code>LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
  LoadModule manager_module modules/mod_manager.so
  LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
  LoadModule advertise_module modules/mod_advertise.so
  
  
  Listen 10.90.0.13:7777
  
  &lt;VirtualHost 10.90.0.13:7777&gt;
  
    &lt;Directory /&gt;
        Require all granted
    &lt;/Directory&gt;
  
    &lt;Location /&gt;
      Order deny,allow
      Allow from all
    &lt;/Location&gt;
  
    ManagerBalancerName mybalancer
    ServerAdvertise on
    EnableMCPMReceive On
  
    &lt;Location /mod_cluster-manager&gt;
      SetHandler mod_cluster-manager
      Order deny,allow
      Allow from all
    &lt;/Location&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>When I access <a href="http://10.90.0.13:7777/mod_cluster-manager" rel="nofollow noreferrer">http://10.90.0.13:7777/mod_cluster-manager</a>, I see the 6 servers registered with the context <code>system1/</code>. They use the same EAR file, by the way.</p>
  
  <p>But this is not the ideal scenario for us. The users accessing urla.com.br/system1/ cannot use the machines of urlb.com.br/system1/ and vice versa.</p>
  
  <p>The only way that I can found to do this (I not tested yet...) is create one profile for each server group, so I can configure a different load balance group in:</p>
  
  <blockquote>
    <p>Profile > URLA-HA / URLB-HA > Subsystems > ModCluster.</p>
  </blockquote>
  
  <p>But in this case, we duplicated all configurations that exists in profile (DataSources, Queues, MailSession, etc). This is painful to maintain.</p>
  
  <p>So, what options we have in my case? Thanks!</p>