06 October, 2023

XM Cloud - Troubleshooting the integration of Pages app with local XM Cloud Instance

As per Sitecore documentation, you can connect XM Cloud Pages app to your local XM cloud instance. 

How should you do it? 
  • Once you browse Pages app (, go to browser developer tools --> Application --> Storage --> Local Storage and open the entry for
  • Add a new key and value. 
    • Key: Sitecore.Pages.LocalXmCloudUrl
    • Value: Your local XM Cloud CM instance. Ex: https://xmcloudcm.localhost/
  • Refresh the pages app and it should connect to your local XM cloud instance. 
I was facing some issues after setting it up. 
  1. refused to connect or couldn't retrieve the page. 

    This happens when your local XM Cloud instance is not logged in. Make sure you login to use local XM Cloud instance in the same browser (another tab) and this error should go away. 

  2. Pages app does not render the content and components from local XM Cloud instance

    Looking at the console log, a possible certificate exception appeared.

    In the environment file, the public rendering host is www.xmcloudpreview.localhost. The Pages app is using https://xmcloudcm.localhost as the local XM Cloud URL, as we set it in the local storage key Sitecore.Pages.LocalXmCloudUrl. Then, the local XM Cloud instance calls the public rendering host and gets the content. However, the local XM Cloud instance does not have a valid certificate for the public rendering host www.xmcloudpreview.localhost.

    Once the certificate was created and placed in the \docker\traefik\certs folder and the config \docker\traefik\config\dynamic\certs_config.yaml was added, the rendering host public URL started working without any certificate errors and the pages app was also able to render the page for editing.

    Go to \docker\traefik\certs, run mkcert www.xmcloudpreview.localhost and it will create the cert and key. You can refer it in certs_config.yaml and restart the rendering container alone. 

    I am looking for other options or solutions which can fix this issue. If this is the only way, Sitecore can add it as part of their initial XM Cloud local instance setup itself. 

No comments:

Post a Comment

blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }