Erick Brenes Solano
software tool logo

Delivery site-mapping not being read

5/9/2024

Context

In this case we had 2 sites in CrafterCMS, the site-mappings.properties file, contained the domains and their respective site id as follows:

hello.com=hello
www.hello.com=hello
world.com=world
www.world.com=world

This mappings file removes the need to use the X-Crafter-Site header or the ?crafterSite=hello URL parameter.

Issue

When accessing hello.com, the default CrafterCMS site was shown, instead of the hello site.

Analysis

Look through the extensions configuration files.

Solution

Enable the mapped multi tenant configurations in delivery. This is done in the rendering-context.xml and services-context.xml configuration files in the delivery engine extensions folder.

These files should have this import statement:

<import resource="classpath*:crafter/engine/mode/multi-tenant/mapped/rendering-context.xml" />