SCORM XBlock, S3

Hello tutor community. Thank you for the amazing work.

We are using the SCORM XBlock for Open edX to add SCORM support to Open edX. Tutor is configured through a plugin to use S3 for storage directly.
The SCORM packages are uploaded to an S3 bucket. They fail to load and/or work in the iframe because of the CROSS DOMAIN SCRIPTING issue
image

Anyone else facing this issue? Any insight would be appreciated.

Hi @moonesque! I have talked to users who faced the same problem. The reason is that content loaded from a different domain name and included in an iframe cannot communicate with the LMS.

Unfortunately, there is nothing that can be done with Tutor to resolve this issue. Your best bet is to proxy your S3 bucket from your own web proxy, such that Scorm content is loaded from your own domain name.

1 Like

I have the same issue. isn’t it possible to use the custom storage backend that you talked about here @regis ?

the custom storage backend solution described in scorm block doesn’t talk about where we have to make those changes. any tip will be helpful.

Yes @CodeWithEmad, you will have to make use of the custom storage solution described in the docs.

I don’t have hand-on experience with this myself, but I’ll paste here verbatim the suggestion of someone that I worked with and who got it to work.

from storages.backends.s3boto import S3BotoStorage
os.environ.update({
    "S3_USE_SIGV4": "true"
})
def scorm_xblock_storage(xblock):
    return S3BotoStorage(
        bucket={{ YourBucketName }},
        access_key={{ YourAWSAccessKeyId }},
        secret_key={{ YourAWSSecretAccessKey }},
        host={{ s3_host }},
        querystring_expire=86400,
        custom_domain={{ your_edxapp_lms_host }}/scorm-xblock # <----- this is the line that matters
    )

XBLOCK_SETTINGS["ScormXBlock"] = {
    "STORAGE_FUNC": scorm_xblock_storage,
}

And then, configure your proxy (e.g: nginx) to serve your static assets from the CDN:

  location ~* ^/scorm-xblock/ {
    proxy_set_header Host YourS3Host;
    rewrite ^/scorm-xblock/(.*) ThePathOfYourFilesInsideTheBucket/$1 break;
    proxy_pass https://YourS3Host;
    proxy_redirect off;
  }

Hope it helps.

2 Likes