Adding ALLOW_CORS_HEADER plugin in tutor

Hello! I am new to Open Edx and I am trying to set up openedx with a custom website I made. and I would like to call openedx api ( from my custom website. I can successfully setup openedx but when I try to call openedx api from my website, I got the error as below on my website.

http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

So I try to add cors header in the lms using tutor plugins according to this documentation but I dont see ALLOW_CORS_HEADER in the cms.env.yml.

In the configuration variables, I cannot find the ALLOW_CORS_HEADERS variable in this docs.

I would like to know how could I allow a custom website (IP ADDRESS) to call openedx api.

Thank you very much.

@Xiao_Long I’ve had success with this by adding a tutor plugin. The only way I was able to get this to work is to have the custom site be the top level domain, and the LMS/CMS exist at a subdomain. The reason for this is the fact that a top level domain can access a subdomain’s cookies, but not the other way around. In my case, I have enabled the marketing site flag.

I’ve set the following in my config.yml:

MARKETING_SITE_ROOT: https://your.domain
CMS_HOST: studio.lms.your.domain
LMS_HOST: lms.your.domain
PREVIEW_LMS_HOST: preview.lms.your.domain

An example of

from tutor import hooks



SHARED_COOKIE_DOMAIN = "your.domain"


I’ll add links below to other threads that go over similar requests: