티스토리 뷰

728x90
반응형

JupyterHub를 Iframe 환경에 적용하기 위해 아래와 같은 설정이 필요하다.

 

[테스트 환경]

Sample App Server : 192.168.56.102

JupyterHub Server : 192.168.56.104

 

1) Sample App

<!doctype html>

<html lang="en">

<head>

  <title>Test Embedded JupyterHub</title>

</head>

<body>

  <div>

    <iframe src="http://192.168.56.104/hub/login"></iframe>

  </div>

</body>

</html>

 

2) Error Message

Refuse to display 'http://192.168.56.104/hub/login' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".

 

[해결방안]

...?

- jupyterhub.config

c.JupyterHub.tornado_settings = { 'headers': { 'Content-Security-Policy': "frame-ancestors * self 192.168.56.102 192.168.56.102:8080"} }

- jupyternotebook.config

.... need add ....

c.Spawner.args = ["'--NotebookApp.tornado_settings={ 'headers': { 'Content-Security-Policy': 'frame-ancestors * self 192.168.56.102 192.168.56.102:8080'} }'"]

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

728x90
반응형