How are you testing that? You are probably always hinting the main server (how is it defined by the way?).
Maybe I don't understand what you qualify by 'main server'. Your talking about JBoss or Apache ?
Actually I have 4 VHosts on port 80, 81, 443 and 444, and I can hit my JBoss cluster through any of them even if I have 'CreateBalancers 2'.
I am taking of VirtualHost in httpd.conf the main server is always there it is any configuration which isn't between <VirtualHost...> and </VirtualHost.>
If you are taking about the virtual-host in the application sever you need UseAlias 1 in httpd.conf that is the Host: hostname that is used for the routing in that case.
Well, I really don't understand how it works.
In httpd.conf, I have:
Then <VirtualHost 10.11.12.13:80> with : ServerName vh1.test.com
And <VirtualHost 10.11.12.13:81> with : ServerName vh2.test.com
If I use CreateBalancers 0 or 2, I can reach my JBoss cluster on both vhosts vh1 and vh2
If I add UseAlias 1 and CreateBalancers 0 or 2 I get HTTP 404 error on both vhosts vh1 and vh2
So, I don't know how to test the difference between CreateBalancers 0 or 2.
With the configuration you have 0 or 2 will behave the same (I am a bit guessing your configuration). You need to add something in the VirtualHost to see the difference... Like adding a header to using mod_rewrite or even a different access_log.
If you get 404 with UseAlias 1 it is because the <alias name="... /> are not correct in the virtual-server you are using. You need alias name="vh1.test.com" or alias name="vh1" and same for vh2 in the other virtual-server.
Well, it's OK now for the 404 error.
I have this on JBoss:
<virtual-server name="default-host" enable-welcome-root="false">
On Apache side I have this :
LoadModule cache_module modules/mod_cache.so
CustomLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh1_access_%Y%m%d.log 86400" combined
ErrorLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh1_error_%Y%m%d.log 86400"
CustomLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh2_access_%Y%m%d.log 86400" combined
ErrorLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh2_error_%Y%m%d.log 86400"
Has not changed since the first post.
Even like that, I still have the same behavior with CreateBalancers 0 or 2. JBoss cluster is reachable by both vhosts.
According to your configuration any request is going to be on one of the VirtualHost... Nothing goes to the main server.
What are you trying to do?
Actually I'm just trying to understand the difference between 'CreateBalancers 0' and 'CreateBalancers 2' .
If you have a test configuration that I can use to figure it out, I will be happy.
After trying to reproduce it, it seems there is something wrong the proxy_server_conf is the same on all servers. Please create a mod_cluster JIRA for the problem.
After reviewing the problem in fact option 0 and 2 behave differently if only the VirtualHost contains a proxy directive. If the VirtualHost doesn't contain a proxy it is ignored by mod_proxy (and mod_cluster).
I have used:
CreateBalancers 0 / 2
CustomLog "logs/access_log.10.36.116.185" common
CustomLog "logs/access_log.192.168.1.35" common
To validate the logic...
And check https://httpd.apache.org/docs/2.4/vhosts/examples.html to get the VirtualHost logic right ;-)