This is likely caused by one of two issues:
- The API key is incorrectly configured (less likely given the symptoms)
- The Headless Services package is missing required configuration on the CD role. (most likely)
To ensure the API key is configured properly, the
CORS Origins and
Allowed Controllers fields should be set to:
I'm making a big assumption that you are attempting this in an On-Prem or Azure PaaS environment and are not using containers.
To ensure that Headless Services are installed properly on your CD, you should be using the
Sitecore Headless Services CD WDP for Sitecore XM from the Sitecore downloads page
If you haven't worked with Sitecore Web Deploy Packages (
.scwdp) before, they are compressed files that you can unpack and manually copy all of the assets from this package to the root of your CD website.
If neither of these two options work for you, take a look at your ShowConfig for the ContentDelivery role.
Make sure that these pipelines are present:
<processor type="Sitecore.LayoutService.Mvc.Pipelines.Initialize.RegisterRoutes, Sitecore.LayoutService.Mvc"
<processor type="Sitecore.LayoutService.Mvc.Pipelines.HttpRequestBegin.SkipContextItemResolutionWhenLayoutServiceRequest, Sitecore.LayoutService.Mvc"
<processor type="Sitecore.LayoutService.Mvc.Pipelines.RequestBegin.ContextItemResolver, Sitecore.LayoutService.Mvc"
These are configured within the file:
You can also quickly confirm whether Headless Server is installed correctly in ContentDelivery by checking the GraphQL playground using this url: