When connectingSitecore Pages(the visual page editor in XM Cloud) to alocal XM Cloud development environment, the connection may fail due toCORS (Cross-Origin Resource Sharing) restrictions.
Sitecore Pagesis hosted onhttps://pages.sitecorecloud.io , which loads content from the developer's local Sitecore instance.
Thelocal Sitecore instance must allow requests frompages.sitecorecloud.io, or the connection will fail due toCORS policy restrictions.
To fix this, the developer must ensure that theenvironment variableSITECORE_Pages_CORS_Allowed_Originsis correctly setto includehttps://pages.sitecorecloud.io.
In a localDocker-based XM Cloud setup, this can be configured indocker-compose.override.ymllike this:
✅Correct Answer: D (The environment variableSITECORE_Pages_CORS_Allowed_Originsis not correctly configured to include pages.sitecorecloud.io.)environment:
- SITECORE_Pages_CORS_Allowed_Origins=https://pages.sitecorecloud.io
If running Sitecore locally without Docker, this setting should be added to theappsettings.jsonfile or set as a system environment variable.
(A) The value of the local storage entry'Sitecore.Pages.LocaIXmCloudUrl'should be set tohttps://pages.sitecorecloud.io→ Incorrect
Thecorrect keyis'Sitecore.Pages.LocalXmCloudUrl', but it should point tothe local Sitecore instance, nothttps://pages.sitecorecloud.io .
Example:
❌Why Other Options Are Incorrect:localStorage.setItem('Sitecore.Pages.LocalXmCloudUrl', 'https://xmcloud.localhost');
This step helps Sitecore Pages find the local instance, butCORS issues must still be resolved separately.
(B) The browser developer tools console does not support the local storage functionality required for this connection → Incorrect
Browserdeveloper tools do supportlocal storage.
If local storage were an issue, developers couldmanually add entriesvia the console.
Example:
localStorage.getItem('Sitecore.Pages.LocalXmCloudUrl'); // Should return 'https://xmcloud.localhost'
(C) The value of the local storage entry"Sitecore.PagesXmCloud"should be set to"enabled"→ Incorrect
There isno such required settingnamed"Sitecore.PagesXmCloud".
The required setting is'Sitecore.Pages.LocalXmCloudUrl', which must be set tothe local instance URLinstead.
Ensure CORS settings are correctly configured:
Manually set the local Sitecore URL in browser storage:
Best Practices for Connecting Sitecore Pages to a Local XM Cloud InstancelocalStorage.setItem('Sitecore.Pages.LocalXmCloudUrl', 'https://xmcloud.localhost');
Sitecore Pages Integration with Local Development– Troubleshooting Sitecore Pages
CORS Configuration in XM Cloud– Allowing Origins for Sitecore Pages
References: