Background of the issue:
We are upgrading from Sitecore 9.2
to Sitecore 10.2
without Sitecore identity server. We are using Ping ID as an Identity provider using Saml2.0 protocol. In application, while clicking on Login button (which will navigate to Ping ID login page on successful redirect), it shows the same-origin policy origin error for Horizon URL. Due to which redirect to Ping ID login page is failed.
Error details:
Login button in application:
Request and Response details from network tab: 1 -> Sitecore application URL 2 -> Sitecore Horizon URL
Solutions tried:
Solution1:
Included below config changes in Web.config file of Sitecore application:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="https://<Horizon URL>" />
<add name="Access-Control-Allow-Methods" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Solution2
: Enable Cors in Controller level where Login functionality handled:
namespace Feature.Login.Controllers
{
[EnableCors(origins: "https://<Horizon URL>", headers: "*", methods: "*")]
public class UserLoginController : Controller
{
// GET: User
/// <summary>
/// Logins to the application with the respective user
/// </summary>
/// <returns>LoginLinks.cshtml</returns>
public ActionResult SSOLogin()
{
}
}
}
Solution3:
Enable CORS origin for Sitecore applicatioin URL in Web.Config file of Horizon web root:
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="32768" />
</requestFiltering>
</security>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Sitecore.AuthoringHost.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
But, nothing was worked out. Please help us to fix this issue.
Referrer-Policy
andContent-Security-Policy
. TheReferrer-Policy
header controls how much referrer information should be included in theReferer
header.Content-Security-Policy
instructs browsers to load resources and send requests generated from JavaScript only to allowed domains, i.e. prevent cross-site scripting. So none of them should be causing a server-side error in Sitecore. Please check your Sitecore logs, does it have any error details?