-2

I have one issue with FXM (Having in mind that all the configurations are enabled).

Here are my configuration details

Sitecore root url - https://projectsample.sc/sitecore

External URL - http://sampledemo/index.aspx

Generated scripts by the FXM has been added to the external url

Steps followed:

I added new external website by using Federated Experience Manager
it generates bundle/beacon script.

I added that script tag to the external page and when I open FEM it
throws error ("Could not validate beacon script - error")

Any help on this would be of great help.

3 Answers 3

2

I can see that your websites are using different protocols, one is http and the other one is https. If you look at the sitecore limitations on https://doc.sitecore.com/developers/93/sitecore-experience-platform/en/requirements-and-limitations.html it is stated this: Your Sitecore site and the external site must both have the same type of connection – http or https

If you are still receiving errors after changing the two websites to the same connection type, you can verify if there are any errors in the FXM logs. If you don't have it enabled in the \App_Config\Sitecore\FederatedExperienceManager\Sitecore.FXM.config file, set the log level to DEBUG:

<logger name="Sitecore.FXM.Diagnostics" additivity="false">   
<level value="DEBUG" />   
<appender-ref ref="FxmLogFileAppender" /> 
</logger>
1
  • Thanks Cristi. Even after making the connection changes the issue was persisting. I checked the network tab found the issue was with CORS. Commented Feb 22, 2021 at 19:06
0

I was able to solve the error by enabling CORS in the external website.

2
  • Hey, Please add information where and how you enabled CORS to have for meaningful answer Commented Feb 23, 2021 at 13:51
  • 1
    Hey Peter Since the external site for me was an MVC application. I enabled to CORS in the global.asax.cs file. We need to install the CORS package and add the below code. var cors = new System.Web.Http.Cors.EnableCorsAttribute("", "", "*"); GlobalConfiguration.Configuration.EnableCors(cors); Commented Feb 24, 2021 at 9:26
0

You can also do this by creating your own class like this :

enter image description here

using System;
using System.Web.Mvc;

public class AllowCrossSiteAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200");
        filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Headers", "*");
        filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Credentials", "true");

        base.OnActionExecuting(filterContext);
    }
}

After this it's let you use this decorator on a method or on the whole controller

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.