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 or SiteId

    If you use a custom hostname in your request without explicitly including a ContextId in the query parameter or header, or a SiteId in the query parameter or body, the system automatically uses the defaultContextId or defaultSiteId 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 or SiteId

    If you use a custom hostname along with a ContextId in the query parameter or header, or a SiteId 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 the ContextId or SiteId 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:

RequestResponse
http://edge.sitecorecloud.io/yourcompany1-yourcompanyltd-p49d-fb1a/media/path/to/mediaFolder/HeroBanner.png

and your registered custom hostname is:

RequestResponse
media.your-company.com

Then you can request the media item from the custom hostname URL:

RequestResponse
https://media.your-company.com/v1/media/edge/images/yourcompany1-yourcompanyltd-p49d-fb1a/media/path/to/mediaFolder/HeroBanner.png

Do you have some feedback for us?

If you have suggestions for improving this article,