Jupyterhub - 画布 LMS 中的 iframe

问题描述

我有两台不同的服务器,安装了一台 Canvas LMS 和一台 JupyterHub。

我将 LTI JupyterHub 作为外部应用程序包含在 Canvas 中并设置配置:

c.JupyterHub.tornado_settings = {
'headers': {
    'Content-Security-Policy': "frame-ancestors 'self' https://xxxxxxx.yyy"
}}

他的问题是,当我点击“启动我的服务器”按钮(图 1)时,iframe 被阻止,因为 jupyterhub 认为它不安全。

如何为 docker 和每个 jupyterhub 用户设置“Content-Security-Policy”设置?

我读到有一个 jupyter_notebook_config.py 文件,我尝试设置它但它似乎不起作用......

enter image description here

解决方法

解决方案: 添加到您的 jupyterhub_config.py:

c.Spawner.args = ['--NotebookApp.tornado_settings={"headers":{"Content-Security-Policy": "frame-ancestors * self https://yourwebsitehere.com"}}','--NotebookApp.disable_check_xsrf=True']

c.JupyterHub.tornado_settings = { 'headers': { 'Content-Security-Policy': "frame-ancestors * self https://yourwebsitehere.com"} }