jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.02k stars 338 forks source link

Content-Security-Policy (IFrame embeding) not working in new version #907

Open LukaPitamic opened 1 year ago

LukaPitamic commented 1 year ago

Bug description

Content-Security-Policy settings are not respected in new version of Jupyter Hub. Following screen capture is demonstrating how same settings worked in JupyterHub v1.4.0 and in v1.5.1 it doesn't work any more:
https://app.screencast.com/F2BhHsTAYG1bo

In order to debug the problem I tried to dive into logs according to:
https://tljh.jupyter.org/en/latest/troubleshooting/logs.html
...no sign of any error in any file

Same settings on both JupyterHub instances

JupyterHub settings in file /opt/tljh/config/jupyterhub_config.d/jupyterhub_config.py:

c.JupyterHub.tornado_settings = {'headers': {'Content-Security-Policy': "frame-ancestors *;"}}
c.Spawner.args = ['--config=/home/jupyter_notebook_config.py']

Jupyter notebook settings in file: /home/jupyter_notebook_config.py

c.NotebookApp.tornado_settings={'headers': {'Content-Security-Policy': "frame-ancestors *;"}}

Other relevant context info

LukaPitamic commented 1 year ago

Hi guys, is there any way to install older version of Jupyter Hub?

MridulS commented 1 year ago

Could you maybe try out the beta 1.0.0 release for TLJH? https://tljh.jupyter.org/en/latest/reference/changelog.html#id1 Does the problem persists?

This comes with JupyterHub 4.X series.

There is also https://github.com/jupyterhub/the-littlest-jupyterhub/issues/312 with some more discussion.

LukaPitamic commented 9 months ago

@MridulS I installed JupyterHub 1.0.0 and went over all available relevant threads addressing this problem. Now on FireFox everything works, however on chromium-based browsers (Brave) I still cannot get it to work - I'm getting:

image

BTW, of course I tried incognito mode without any plugins.

I simply don't know what else to do, any direction would be highly apprichiated. The goal is very simple, to embed JupyterHub into Nextcloud iFrame to integrate user experience of the whole team.