【发布时间】:2020-02-17 06:44:30
【问题描述】:
我正在尝试将与 jupyterhub 一起运行的 jupyterlab 集成到 iframe 中。 我在配置文件中进行了所有必要的更改。 在 jupyter_notebook_config.py 我做了以下更改。
c.NotebookApp.tornado_settings = {'headers': {
'Access-Control-Allow-Origin': '*',
'Content-Security-Policy': 'frame-ancestors http://localhost:9005'
}}
在 jupyterhub_config.py 中我添加了以下内容
c.JupyterHub.tornado_settings = {'headers': {
'Access-Control-Allow-Origin': '*',
'Content-Security-Policy': 'frame-ancestors http://localhost:9005'
}}
但是,当我尝试在 iframe 中打开 http://localhost:8002/user/admin/lab URL 时,我收到以下错误
Refused to display 'http://localhost:8002/user/admin/lab' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".
如果我遗漏了什么或者我的配置有问题,有人可以告诉我吗?
【问题讨论】:
-
不同浏览器的 iframe 行为可能不同,例如Firefox vs chrome。
标签: jupyter-notebook jupyter jupyter-lab jupyterhub