VHost Templates

Introduction

Introduced in version 0.5, ZeroConf can use ADC configured VHost Templates.

In general, VHost Templates provide a method to generate many VHosts that differ only by domain and cluster. Logically then, it follows that ZeroConf domains should also be able to use VHost Templates.

Pretext

ZeroConf uses VHost Templates slightly different than a Template's Member VHost. A Member VHost will inherit from the Template VHost, all else is inherited from the Global VHost/Server level configurations.

ZeroConf will inherit from the Template VHost. If a value is not set in the template vhost, Server Level inheritance is not guaranteed. Therefore, it is recommended to configure as much of the values as possible in the event that a configuration did not inherit the Server level value.

Only a VHost Template needs to be configured. There is no need to create member VHosts for ZeroConf to be able to use the template.

ADC Configurations

In addition to the general template configurations, the following options are available:

In Server->ZeroConf:

Separate VHost Per Domain

In Virtual Host Templates->Template->ZeroConf section:

Used By ZeroConf
Separate VHost Per Domain

The Used By ZeroConf configuration toggles whether to allow ZeroConf to use the template. Defaults to yes.

The two Separate VHost Per Domain configurations control how the ADC builds the VHosts. One's value does not affect the other; both default to 'no'.

By default, domains that share backend combinations will also share VHosts and cache stores. Enabling separate VHost per domain creates individual VHosts and cache stores.

Do note that ZeroConf is not context aware. It does not know the similarities between example.com and blog.example.com. If Separate VHost per Domain is selected, these domains will have their own VHosts.

ZeroConf Messages

By default, no templates are selected. Therefore, the server level settings are used to create the VHosts.

To select a template, the ZCUP message needs to use a vhost entry containing a "template" configuration.

For Example:

Suppose we want to disable cache for a specific domain. In the ADC configurations, I can create a VHost Template named noCacheTemplate that disables the cache settings. My ZCUP message could look like the following:

conf=
{
"vhost_list" :
        [
                {
                "template" : "noCacheTemplate",
                "domain_list" :
                        [ "c7-30.ls.com","mail.c7-30.ls.com","www.c7-30.ls.com","cpanel.c7-30.ls.com","webdisk.c7-30.ls.com","webmail.c7-30.ls.com"],
                "conf_list" : [
                        {
                        "lb_port_list" : [443],
                        "dport" : 443,
                        "be_ssl" : true,
                        "ip_list" :
                                [
                                        { "ip": "10.10.40.153", "port_list" : [443] }
                                ]
                        }
                ]
                }
,               {
                "domain_list" :
                        [ "newdomain100.com","mail.newdomain100.com","www.newdomain100.com","webmail.newdomain100.com","cpanel.newdomain100.com","webdisk.newdomain100.com"],
                "conf_list" : [
                        {
                        "lb_port_list" : [443],
                        "dport" : 443,
                        "be_ssl" : true,
                        "ip_list" :
                                [
                                        { "ip": "10.10.40.153", "port_list" : [443] }
                                ]
                        }
                ]
                }
        ]
}

This ZCUP configuration includes two vhosts. The conf list is identical; the only difference is the domain list and a template configuration in the first VHost.

The first VHost uses the VHost Template named noCacheTemplate configured in the ADC. The second VHost uses the server level configurations.


Last update: April 27, 2020