Commit df863e13 by wajeeha-khalid Committed by Fred Smith

used edxapp vars for cors whitelist and scorm xblock settings

parent e722f3e3
...@@ -291,6 +291,7 @@ ...@@ -291,6 +291,7 @@
- Added `EDXAPP_VIDEO_TRANSCRIPTS_SETTINGS` to configure S3-backed video transcripts. - Added `EDXAPP_VIDEO_TRANSCRIPTS_SETTINGS` to configure S3-backed video transcripts.
- Removed unused `EDXAPP_BOOK_URL` setting - Removed unused `EDXAPP_BOOK_URL` setting
<<<<<<< HEAD
- Role: insights - Role: insights
- Removed `INSIGHTS_FEEDBACK_EMAIL` which is no longer used, as it was deemed redundant with `INSIGHTS_SUPPORT_EMAIL`. - Removed `INSIGHTS_FEEDBACK_EMAIL` which is no longer used, as it was deemed redundant with `INSIGHTS_SUPPORT_EMAIL`.
...@@ -350,3 +351,7 @@ ...@@ -350,3 +351,7 @@
- Added `EDXAPP_ENV_EXTRA`, with default value as it was in the server template. - Added `EDXAPP_ENV_EXTRA`, with default value as it was in the server template.
- Added `SCORM_PKG_STORAGE_DIR`, with default value as it was in the server template. - Added `SCORM_PKG_STORAGE_DIR`, with default value as it was in the server template.
- Added `NGINX_EDXAPP_LMS_APP_EXTRA`, with default value as it was in the server template. - Added `NGINX_EDXAPP_LMS_APP_EXTRA`, with default value as it was in the server template.
- Role: edxapp
- Added `EDXAPP_SCORM_PKG_STORAGE_DIR`, with default value as it was in the server template.
- Added `EDXAPP_SCORM_PLAYER_LOCAL_STORAGE_ROOT`, with default value as it was in the server template.
...@@ -659,6 +659,10 @@ EDXAPP_BLOCK_STRUCTURES_SETTINGS: ...@@ -659,6 +659,10 @@ EDXAPP_BLOCK_STRUCTURES_SETTINGS:
# The age at which a learner no longer requires parental consent, or None # The age at which a learner no longer requires parental consent, or None
EDXAPP_PARENTAL_CONSENT_AGE_LIMIT: 13 EDXAPP_PARENTAL_CONSENT_AGE_LIMIT: 13
# Scorm Xblock configurations
EDXAPP_SCORM_PKG_STORAGE_DIR: ""
EDXAPP_SCORM_PLAYER_LOCAL_STORAGE_ROOT: ""
#-------- Everything below this line is internal to the role ------------ #-------- Everything below this line is internal to the role ------------
#Use YAML references (& and *) and hash merge <<: to factor out shared settings #Use YAML references (& and *) and hash merge <<: to factor out shared settings
......
...@@ -155,20 +155,3 @@ NGINX_EDXAPP_LMS_APP_EXTRA: "" ...@@ -155,20 +155,3 @@ NGINX_EDXAPP_LMS_APP_EXTRA: ""
NGINX_EDXAPP_CMS_APP_EXTRA: "" NGINX_EDXAPP_CMS_APP_EXTRA: ""
# Extra settings to add to site configuration for LMS # Extra settings to add to site configuration for LMS
NGINX_EDXAPP_LMS_APP_EXTRA: "" NGINX_EDXAPP_LMS_APP_EXTRA: ""
NGINX_EDXAPP_LMS_APP_EXTRA: ""
EDXAPP_ENV_EXTRA:
XBLOCK_SETTINGS:
ScormXBlock:
SCORM_PLAYER_LOCAL_STORAGE_ROOT: ""
SCORM_PLAYER_BACKENDS:
ssla:
name: ""
location: ""
configuration: {}
SCORM_PKG_STORAGE_DIR: ""
CORS_ORIGIN_WHITELIST: []
# Scorm Xblock configurations
SCORM_PKG_STORAGE_DIR: "scorms"
SCORM_PLAYER_LOCAL_STORAGE_ROOT: "scormplayers"
{% if EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock %} {% if EDXAPP_SCORM_PKG_STORAGE_DIR %}
location ~ ^/{{ EDXAPP_MEDIA_URL }}/{{ EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock.SCORM_PKG_STORAGE_DIR }}/(?P<file>.*) { location ~ ^/{{ EDXAPP_MEDIA_URL }}/{{ EDXAPP_XBLOCK_SETTINGS.ScormXBlock.SCORM_PKG_STORAGE_DIR or EDXAPP_SCORM_PKG_STORAGE_DIR}}/(?P<file>.*) {
add_header 'Access-Control-Allow-Origin' $cors_origin; add_header 'Access-Control-Allow-Origin' $cors_origin;
add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
root {{ edxapp_media_dir }}/{{ EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock.SCORM_PKG_STORAGE_DIR or SCORM_PKG_STORAGE_DIR}}; root {{ edxapp_media_dir }}/{{ EDXAPP_XBLOCK_SETTINGS.ScormXBlock.SCORM_PKG_STORAGE_DIR or EDXAPP_SCORM_PKG_STORAGE_DIR}};
try_files /$file =404; try_files /$file =404;
expires 31536000s; expires 31536000s;
} }
......
...@@ -44,7 +44,7 @@ geo $http_x_forwarded_for $embargo { ...@@ -44,7 +44,7 @@ geo $http_x_forwarded_for $embargo {
{%- endif %} {%- endif %}
{% if EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock %} {% if EDXAPP_CORS_ORIGIN_WHITELIST %}
# The Origin request header indicates where a fetch originates from. It doesn't include any path information, # The Origin request header indicates where a fetch originates from. It doesn't include any path information,
# but only the server name (e.g. https://www.example.com). # but only the server name (e.g. https://www.example.com).
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin for details. # See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin for details.
...@@ -53,7 +53,7 @@ geo $http_x_forwarded_for $embargo { ...@@ -53,7 +53,7 @@ geo $http_x_forwarded_for $embargo {
# of our known hosts--served via HTTP or HTTPS--we allow for CORS. Otherwise, we set the "null" value, disallowing CORS. # of our known hosts--served via HTTP or HTTPS--we allow for CORS. Otherwise, we set the "null" value, disallowing CORS.
map $http_origin $cors_origin { map $http_origin $cors_origin {
default "null"; default "null";
{% for host in EDXAPP_ENV_EXTRA.CORS_ORIGIN_WHITELIST %} {% for host in EDXAPP_CORS_ORIGIN_WHITELIST %}
"~*^https?:\/\/{{ host|replace('.', '\.') }}$" $http_origin; "~*^https?:\/\/{{ host|replace('.', '\.') }}$" $http_origin;
{% endfor %} {% endfor %}
} }
......
{% if EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock %} {% if EDXAPP_SCORM_PLAYER_LOCAL_STORAGE_ROOT %}
# w/in scorm/, override default return 403 for these file types # w/in scorm/, override default return 403 for these file types
location ~ ^/static/scorm/(?:.*)(?:\.xml|\.json) { location ~ ^/static/scorm/(?:.*)(?:\.xml|\.json) {
try_files /{{ EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock.SCORM_PLAYER_LOCAL_STORAGE_ROOT }}/$file =404; try_files /{{ EDXAPP_XBLOCK_SETTINGS.ScormXBlock.SCORM_PLAYER_LOCAL_STORAGE_ROOT or EDXAPP_SCORM_PLAYER_LOCAL_STORAGE_ROOT}}/$file =404;
} }
location ~ "/scorm/(?P<file>.*)" { location ~ "/scorm/(?P<file>.*)" {
add_header 'Access-Control-Allow-Origin' $cors_origin; add_header 'Access-Control-Allow-Origin' $cors_origin;
add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
try_files /{{ EDXAPP_ENV_EXTRA.XBLOCK_SETTINGS.ScormXBlock.SCORM_PLAYER_LOCAL_STORAGE_ROOT or SCORM_PLAYER_LOCAL_STORAGE_ROOT}}/$file =404; try_files /{{ EDXAPP_XBLOCK_SETTINGS.ScormXBlock.SCORM_PLAYER_LOCAL_STORAGE_ROOT or EDXAPP_SCORM_PLAYER_LOCAL_STORAGE_ROOT}}/$file =404;
} }
{% endif %} {% endif %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment