This article covers a Bloomreach Experience Manager version 13. There's anupdated version available that covers our most recent release.
Hostname Matching
During this phase, thehostname of theHttpServletRequest is attempted to be matched to a configuredvirtualhost in the HST configuration. For thehostname, the Host (orX-Forwarded-Host request header if present) is used, which returns the original host information as requested by the client.Virtualhosts are configured inreversed hierarchy. So assume we have the configuration as follows:
/hst:hst: /hst:hosts: jcr:primaryType: hst:virtualhosts /dev-localhost: jcr:primaryType: hst:virtualhostgroup /localhost: jcr:primaryType: hst:virtualhost /test-env: jcr:primaryType: hst:virtualhostgroup /com: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /test: jcr:primaryType: hst:virtualhost /acct-env: jcr:primaryType: hst:virtualhostgroup /com: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /acct: jcr:primaryType: hst:virtualhost /prod-env: jcr:primaryType: hst:virtualhostgroup /com: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /www: jcr:primaryType: hst:virtualhost
This means we:
Have four environments (virtualhostgroups),dev-localhost,test-env,acct-env andprod-env. We separate environments because the HST supportscross-domain linking out-of-the-box, but we do not want links ever to be created betweendifferent environments. The HST willnever create a link between differentvirtualhostgroups. Thus for example fromwww.example.com a link will never resolve toacct.example.com as this would imply a link fromprod-env toacct-env.
Have the following available hosts:
localhosttest.example.comacct.example.comwww.example.com
Note thatexample.com, and evencom are also valid hosts, but, as will be explained below, a host only becomes a host the HST can match when there is at least ahst:root node below it of typehst:mount. So, if the node
/hst:hst/hst:hosts/com/example
would get a nodehst:root attached to it, then it would become a real possible host.
If you want to add besides the.com hosts also.fr hosts (and sites), thehost configuration would become:
/hst:hst: /hst:hosts: jcr:primaryType: hst:virtualhosts /dev-localhost: jcr:primaryType: hst:virtualhostgroup /locahost: jcr:primaryType: hst:virtualhost /test-env: jcr:primaryType: hst:virtualhostgroup /com: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /test: jcr:primaryType: hst:virtualhost /fr: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /test: jcr:primaryType: hst:virtualhost /acct-env: jcr:primaryType: hst:virtualhostgroup /com: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /acct: jcr:primaryType: hst:virtualhost /fr: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /acct: jcr:primaryType: hst:virtualhost /prod-env: jcr:primaryType: hst:virtualhostgroup /com: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /www: jcr:primaryType: hst:virtualhost /fr: jcr:primaryType: hst:virtualhost /example: jcr:primaryType: hst:virtualhost /www: jcr:primaryType: hst:virtualhost
Thecom nodes are the same as before, but, there have also been added thefr hosts. Now, also the following extra hosts are available:
test.example.fracct.example.frwww.example.fr
There has not been added a new French host forlocalhost. On local development, you normally just want to access all sites over localhost. SeeMount Matching how this is normally done.
@hst:responseheaders on aVirtualHost
Property name | Example | Description |
hst:responseheaders | ["Access-Control-Allow-Origin: http://localhost:3000", "Access-Control-Allow-Credentials: true"] | Applicable since Bloomreach Experience Manager 12.3.0. Custom HTTP Response Header(s) to be always written for a request on this virtual host, and its descendant mounts and sitemap items unless the property is overriden. For example, when Cross-Origin Resource Sharing (CORS) is required with this sitemap item, you can configure related response headers through this property. This property is to be set to a string array, each of which should be in the form of ( header_name + ':' + header_value ) like the example on the left. |