Try our conversational search powered by Generative AI!

Content delivery Api always return url have hostname.

Vote:
 

I tested with Alloy foundation project, which referencing these packages:

<ItemGroup>
    <PackageReference Include="EPiServer.CMS" Version="12.18.0" />
    <PackageReference Include="EPiServer.CMS.AspNetCore.HtmlHelpers" Version="12.13.1" />
    <PackageReference Include="EPiServer.CMS.AspNetCore.Mvc" Version="12.13.1" />
    <PackageReference Include="EPiServer.CMS.AspNetCore.Routing" Version="12.13.1" />
    <PackageReference Include="EPiServer.CMS.AspNetCore.TagHelpers" Version="12.13.1" />
    <PackageReference Include="EPiServer.CMS.AspNetCore.Templating" Version="12.13.1" />
    <PackageReference Include="EPiServer.ContentDeliveryApi.Cms" Version="3.7.0" />
    <PackageReference Include="Wangkanai.Detection" Version="5.2.0" />
    <PackageReference Include="EPiServer.Framework" Version="12.13.1" />
</ItemGroup>

Added Content delivery api via Startup with ForceAbsolute setted false.

services.AddContentDeliveryApi();
services.ConfigureContentApiOptions(options =>
{
      options.FlattenPropertyModel = true;
      options.ForceAbsolute = false;  
});

Website configurations have no change in CMS, have * and localhost:5000, one temporary site setted to Edit type as image bellow:

Site  config

When testing via PostMan, I always get absolute URL with domain name is edit website in response from Content delivery Api. The url returning relative path in browser DOM as bellow:

Url from Content Delivery Api having edit domain path
Same content, in dom not have domain name.

I think this is a bug, please advise.

Thanks all.

#306029
Edited, Aug 01, 2023 6:35
Vote:
 

If ForceAbsolute is set to true the returned value will always be an absolute URL; otherwise, it will depend on the current context. 

#306032
Aug 01, 2023 9:33
Dzung Nguyen - Aug 01, 2023 9:51
Thank you for your response, I missed ForceAbsolute is false and the Site settings having one Edit domain, please re-check and advise if you can.
* 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.