Try our conversational search powered by Generative AI!

Setting up content editing for an externally hosted frontend breaks images in edit mode.


If you configure the CMS to use an external frontend site (to enable on-page editing on the externa site), images will break at some places in edit mode. Thumbnail images for example.


services.Configure<ExternalApplicationOptions>(options => options.OptimizeForDelivery = true);

Thumbnail images will get this url,,62/Thumbnail?epieditmode=False?1695142172388 is the frontend site, not the CMS site.

I have tried to set the CMS-hostname to type "Edit", but that didn't help.

Is this a bug, or did I configure something wrong?

Sep 19, 2023 17:10

How to reproduce

  • Set up a new cms by doing dotnet new epi-alloy-mvc
  • Update to latest version of Episerver.CMS (12.22.8)
  • Add latest version of EPiServer.ContentDeliveryAPI.CMS (3.9.0)
    and configure Delivery API like this:
     services.AddContentDeliveryApi(options =>
     services.Configure<EPiServer.ContentApi.Core.Configuration.ContentApiOptions>(options =>
         options.IncludeEmptyContentProperties = false;
         options.IncludeMasterLanguage = false;
  • Configure edtiting on external site like this
      services.Configure<ExternalApplicationOptions>(options => options.OptimizeForDelivery = true);
  • Add a new host under Manage Websites in admin mode
    Host name:
    Type: Primary


1. ForceAbsolute option for ContentDelivery API will have no effect on the json returned from the API. Host name is always included.
2. Thumbnail images are broken in edit mode, since they are requested using the frontend host name (but with the port of the CMS host)

Oct 02, 2023 14:50

When decompiling the method seems it does the following

 public void ConfigureForExternalTemplates()
            ServiceLocator.Current.GetInstance<RoutingOptions>().UsePrimaryHostForOutgoingUrls = true;
            RegisterFakeTemplate = true;

Based on that code seems to be doing what you are describing.  Not sure why you would ever use primary host for images though.

Oct 02, 2023 15:06
Erik Henningson - Oct 03, 2023 7:35
Thanks Mark! Maybe I should try to not call ConfigureForExternalTemplates, but just RegisterFakeTemplate, and see if that works 😊
Erik Henningson - Oct 04, 2023 6:53
Nah, that didn't help.
I tried
services.Configure(delegate (TemplateOptions r)
r.RegisterFakeTemplate = true;
services.Configure(delegate (ContentApiOptions options)
options.ValidateTemplateForContentUrl = false;
instead of
It fixes the issue with thumbnails, but it it doesn't load the external site when trying to do on-page editing.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.