Resolving a custom hostname during a request
When you create a custom hostname it's associated with either defaultContextId
or defaultSiteId
, or both. These IDs help determine access to specific applications supported by Sitecore. After your custom hostname is verified, it can be used to route traffic to the correct service based on its associated IDs.
Sitecore identifies the target service or application of your request, based on the hostname you use. Here are the possible scenarios:
-
Use a custom hostname without
ContextId
orSiteId
If you use a custom hostname in your request without explicitly including a
ContextId
in the query parameter or header, or aSiteId
in the query parameter or body, the system automatically uses thedefaultContextId
ordefaultSiteId
linked to that custom hostname. This simplifies your requests because you don't have to manually include those IDs every time. -
Use a custom hostname with
ContextId
orSiteId
If you use a custom hostname along with a
ContextId
in the query parameter or header, or aSiteId
in the query parameter or body, the system will prioritize these provided IDs over the default ones associated with the hostname. -
Use the default hostname
If you use the default
edge-platform.sitecorecloud.io
hostname, there are no specific IDs automatically associated with it. To make sure your request reaches the correct destination, you need to include either theContextId
orSiteId
in the request.
Custom hostname media item requests
To prevent search engines from indexing your media on the http://edge.sitecorecloud.io domain
, Experience Edge media requests include the X-Robots-Tag:noindex
header.
However, when requesting a media item from a custom hostname, you can use the relative path /v1/media/edge/images/
to have the X-Robots-Tag:noindex
header omitted from the response. This lets search engines properly index media items on your custom domain, improving SEO.
To make a media request using a custom hostname, reconstruct the URL to combine the custom hostname, relative path /v1/media/edge/images/
, and relative path to the media item.
For example, if the Experience Edge media item URL is:
http://edge.sitecorecloud.io/yourcompany1-yourcompanyltd-p49d-fb1a/media/path/to/mediaFolder/HeroBanner.png
and your registered custom hostname is:
media.your-company.com
Then you can request the media item from the custom hostname URL:
https://media.your-company.com/v1/media/edge/images/yourcompany1-yourcompanyltd-p49d-fb1a/media/path/to/mediaFolder/HeroBanner.png