4

I'm trying to use the CORS settings under Site Grouping, but they don't seem to do anything. I also can't seem to find any documentation about it. Does anyone know of documentation or know what the secret is to get these to work?

I don't get any errors, they just don't seem to have any impact on the response headers in any way. I have verified that the changes have been published properly.

This is the settings I'm talking about:

enter image description here

2 Answers 2

1

I had raised a Sitecore support ticket for this same issue and below is the response that I got.

  • Please find below the documentation of how to include credentials on cross-origin requests for an SXA site:

https://doc.sitecore.com/developers/sxa/19/sitecore-experience-accelerator/en/include-credentials-on-cross-origin-requests.html

To make the client communicate with the SXA site you should perform the following steps:

Create a page with the JSON component.

  • Open page1 in the Experience Editor;
  • Choose "JSON" device in the "Experience (tab)->Device";
  • Add the necessary "JSON" component, for example, "JSON List". Please see the video for details: http://www.screencast.com/t/Fha6PWGB

Make a JSON device valid for correct resolving during the request from the client, for example, make a JSON device as default one or add some query string: https://www.screencast.com/t/0MYGLrwCS

Publish site;

For example, if we change "Allow Origin" from "*" to "http://test", we will not be able to get a response from the server. Please see the video for details: http://www.screencast.com/t/MkSxzXP0

0
-4

The CORS is to configure cross domain request!! You will not get any error as it is not related to your domain and hosting setup, it will impact to other domain trying to access your APIs.

https://doc.sitecore.net/sitecore_experience_platform/82/developing/developing_with_sitecore/sitecoreservicesclient/the_entityservice_and_cors

https://www.w3.org/TR/cors/

You can refer to below example for clear understanding and use of CORS.

https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/enabling-cross-origin-requests-in-web-api

5
  • I know what CORS is... the settings don't seem to work. My issue isn't that I don't know what to put in the setting, my issue is that no matter what I put in changes anything on the site. Commented Jun 6, 2018 at 15:29
  • To be specific... the Sitecore SXA settings under Site Grouping don't seem to work... Commented Jun 6, 2018 at 15:34
  • The original question was about using CORS in SXA, not about CORS itself. Please provide some input about how to make the CORS functionality work in SXA. Commented Jun 6, 2018 at 15:35
  • I might have miss understood the question? But you have asked for the documentation and purpose/use of cors in SXA.. so hope you have referred the links I have shared before commenting.. I might not satisfy your need but the document I have shared explain how and when to configure cros in SXA? I am sharing that link again for your reference. doc.sitecore.net/sitecore_experience_platform/82/developing/….
    – NSP
    Commented Jun 6, 2018 at 15:48
  • Again, I am looking for documentation or help with the CORS settings under the SXA site grouping. The documentation you are providing appears to me to be related to general Sitecore documentation and does not appear to relate to SXA at all. Unless I'm missing something, it doesn't relate to my question at all. I will update my question to include the fields in question. Commented Jun 7, 2018 at 20:17

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.