0

I use the following configuration for setting the CDN prefix for media files in my sitecore. But when viewing a page within the experience editor, none of the images can be reached by the CMS as the page is not public and behind a login wall.

I'm using Sitecore XP Single 9.0.2 and wa

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"
               xmlns:set="http://www.sitecore.net/xmlconfig/set/">
    <sitecore>
        <settings>
            <!--Set the Media Server URL to the Azure CDN endpoint-->
            <setting name="Media.MediaLinkServerUrl">
                <patch:attribute name="value">https://sitecore-dev-cdn.azureedge.net</patch:attribute>
            </setting>

            <!--This will cause the Media Link Provider to include the above URL in the media links that are rendered.-->
            <setting name="Media.AlwaysIncludeServerUrl">
                <!--SET THIS VALUE TO FALSE WHEN WORKING IN A LOCAL DEV ENVIRONMENT-->
                <patch:attribute name="value">false</patch:attribute>
            </setting>

            <!--Cacheability needs to be set to public, otherwise the CDN will not cache media.-->
            <setting name="MediaResponse.Cacheability">
                <patch:attribute name="value">public</patch:attribute>
            </setting>
        </settings>
    </sitecore>
</configuration>
  • 1
    Are you familiar with Sitecore config roles? You can disable (via config files) on CM only. Check this guide jammykam.wordpress.com/2017/11/01/… – josedbaez Jan 21 '19 at 16:43
  • Hi @josedbaez but that would still set Media.AlwaysIncludeServerUrl to true or false globally for that environment right? The issue I face is that all images are loaded from the CDN effortlessly when viewing the published and public pages, but when editing in the live experience editor the images can't be loaded from the cdn. – Anh-Duc Jan 22 '19 at 9:44
  • 2
    Yes, but why not disable CDN on CM entirely? So only CDs (which are available to CDN) use the cdn? – josedbaez Jan 22 '19 at 9:58
  • @josedbaez Ah right, that does make sense. Thanks – Anh-Duc Jan 22 '19 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.