STEAMforVietnam / edx-platform

The Open edX platform, the software that powers edX!
http://openedx.org/
GNU Affero General Public License v3.0
2 stars 2 forks source link

Enable requests from liveapp (CORS, CSRF) #17

Open vthily opened 3 years ago

vthily commented 3 years ago

Enable requests from liveapp (CORS, CSRF)

-The current app in steamforvietnam.org is working fine. -Settings in steamforvietnam.net is NOT working (changes related to the koa.2 codebase, some environment variables are deprecated or moved).

vthily commented 3 years ago
  1. Update in the edx-platform/cms/envs/common.py
... # Inside the features
    'ENABLE_CORS_HEADERS': True,
    'ENABLE_CROSS_DOMAIN_CSRF_COOKIE': True,
...

CORS_ORIGIN_WHITELIST = ['live.steamforvietnam.org', 'www.live.steamforvietnam.org', 'live.steamforvietnam.net', 'www.live.steamforvietnam.net']
CORS_ORIGIN_ALLOW_ALL = False

LOGIN_REDIRECT_WHITELIST = []

############### Settings for video pipeline ##################
VIDEO_UPLOAD_PIPELINE = {
    'BUCKET': '',
    'ROOT_PATH': '',
}
  1. Update in the edx-platform/lms/envs/common.py
    # Allows to configure the LMS to provide CORS headers to serve requests from other domains
    'ENABLE_CORS_HEADERS': True,
  1. config/lms.env.json and config/cms.env.json
    "ENABLE_CROSS_DOMAIN_CSRF_COOKIE": true
    },
    "CROSS_DOMAIN_CSRF_COOKIE_DOMAIN": "steamforvietnam.net",
    "CROSS_DOMAIN_CSRF_COOKIE_NAME": "steamvn-csrftoken",
    "CSRF_TRUSTED_ORIGINS": ["live.steamforvietnam.org", "www.live.steamforvietnam.org", "live.steamforvietnam.net", "www.live.steamforvietnam.net"],