@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
:
FEATURES:
- ENABLE_MKTG_SITE: true
MARKETING_SITE_BASE_URL: your.domain
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 my-plugin.py
:
from tutor import hooks
hooks.Filters.ENV_PATCHES.add_items([
(
"openedx-lms-common-settings",
f"""
CORS_ORIGIN_WHITELIST.append("https://your.domain")
CSRF_TRUSTED_ORIGINS.append("https://your.domain")
LOGIN_REDIRECT_WHITELIST.append("https://your.domain")
SESSION_COOKIE_DOMAIN="your.domain"
SHARED_COOKIE_DOMAIN = "your.domain"
""",
),
],
priority=hooks.priorities.LOW
)
I’ll add links below to other threads that go over similar requests: