The Site Tag is the most important identifier for multi-site hosten and the appropriate resource configuration and settings.
When accessing the system an URL is used which includes the full qualified hostname (domain name) (FQDN). The system uses the first hostname part (the string before the first dot) as the automatic build Site Tag. If this string equals to “www”, then the next hostname part is used.
"example.com" => "example"
"www.example.com" => "example"
"vancouver.example.com" => "vancouver"
"www.vancouver.example.com" => "vancouver"
Using the Site Tag different resource settings could be configured.
{
"db": {
"default": {
"username": "database_username",
"password": "database_password",
"database": "database"
},
"vancouver": {
"database": "database_vancouver"
}
}
}
This example will use a different database for Site Tag “vancouver”.
On the one hand it may become difficult to clearly structure resource settings with many and/or similiar domain names. On the other hand it may come to situations, where special base domains need the same base resources, but special sub domains need differing resources.
Imagine you want to build a supplier and a customer portal. Both would use the same database - the one you would use for the application to manage your company - but a different Application Definition.
For this the Mapping feature “map” has been implemented.
{
"map": {
"init": {
"site1.example.com": "site1",
"site2.example.com": "site1"
},
"run": {
"site2.example.com": "site2"
}
}
}
With this example domain name “site1.example.com” and “site2.example.com” have set a Site Tag of “site1” while “init” of the system - and therefore use the same configuration and resource settings - while “site2.example.com” gets Site Tag “site2” set on “run” which then would load a different Application Definition.
The Site Tag set here will get applied while the system is initializing. This includes configuration and resource settings as well as the complete database and service initialization.
The Site Tag set here will stay till the end of the current request, so this is the right place to set the Application Definition.