title: Dynamic Wildcard settings in Tomcat Server.xml (Non www)
body: <p>For example.com, the <strong>appBase</strong> for</p>
  
  <p>a) <strong>www.example.com</strong> &amp; <strong>example.com</strong> is <code>/home/example/public_html/e</code> - A wordpress site.</p>
  
  <p>b) any other <strong>*.example.com</strong> is <code>/home/example/public_html</code> - A Java web app.</p>
  
  <p>To achieve this, in <strong>server.xml</strong>, I am maintaining the following</p>
  
  <p>a) For www &amp; example.com</p>
  
  <pre><code>&lt;Host name="example.com" appBase="/home/example/public_html/e" ...&gt;
  &lt;Alias&gt;www.example.com&lt;/Alias&gt;
  ...
  &lt;/Host&gt;
  </code></pre>
  
  <p>b) For other wildcards, the following is <strong>NOT WORKING</strong></p>
  
  <pre><code>&lt;Host name="*.example.com" appBase="/home/example/public_html" ...&gt;
  ...
  &lt;/Host&gt;
  </code></pre>
  
  <p>So, as a <strong>workaround</strong>, I have to <strong>MANUALLY ADD</strong> this whenever a,b,c etc are dynamically registered by the customers. Everytime requiring a Tomcat restart.</p>
  
  <pre><code>&lt;Host name="*.example.com" appBase="/home/example/public_html" ...&gt;
  &lt;Alias&gt;a.example.com&lt;/Alias&gt;
  &lt;Alias&gt;b.example.com&lt;/Alias&gt;
  &lt;Alias&gt;c.example.com&lt;/Alias&gt;    
  ...
  &lt;/Host&gt;
  </code></pre>
  
  <p><strong>MY QUESTION</strong></p>
  
  <p>Since the wildcards are dynamically generated at client registration, how do I <strong>dynamically set</strong> in server.xml such that the <strong>manual entry</strong> &amp; <strong>Tomcat restart can be avoided</strong>.</p>