-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Setting up CSP for embedding notebook (eg: in iframe) #886
Comments
please indicate which exact setting you used, and on which domain you are trying to host ? It seem like you are trying to host on port 9191 and only allowing 9999. |
Thanks @Carreau
|
That's redundant, if the notebook port and app are |
yes, suppose my website URL is ec2-xx-xx-xxx-xx.compute-1.amazonaws.com and port is 9999. |
Depends, let's say I have a notebook server that runs on ec2, and that i want to embed a notebook on
But I'm not an expert on that. There seem to be an example in old docs that seem to be missing on new one. |
Renamed issue to remind us to write better documentation on that, or make it easier to find. |
Thank you very much @Carreau. It is working fine now. |
@Carreau When creating a new notebook it will open into new browser(or new tab). Is this possible it will open in same browser(same tab) ? |
Hum, likely yes, you need to inject JS (through custom.js) and change the value of |
@Carreau Thanks for tagging this for documentation review 👍 |
Hello @Carreau I am trying something like:
added path into jupyter_notebook_config.py
But it didn't work. Any idea what is wrong here ? |
That's definitively not the right way to do it, but it works:
|
@Carreau : Yes definitively, I was wrong. Now it is working. Thank you so much for your help. |
Reopening to fix docs. |
@Carreau I used this setting to get the notebook login page to show up on an iframe on socrates-login1/jupyter c.JupyterHub.tornado_settings = {'headers': {'Content-Security-Policy': "frame-ancestors 'self' http://socrates-login1/"} } And it works for the login page. But once the logged in I get the same error for the user profile pages. Refused to display 'http://socrates-login1:7800/user/psplinter/tree' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'". Do I need to set this for each user? source /opt/cray/anaconda3/bin/activate /opt/cray/jupyter/python3_venv |
I faced the same issue and was debugging since 2 days. Finally this post saved me! |
@Carreau after creating the custom.js, how did you specify your jupyter to use this file ? I create the custom.js in the forlder ~/.jupyter/custom/custom.js, restart my docker image, but nothing happened. Still have my notebook in a new tab. |
I guess the docs still need updating? |
Hello @qmaxquique
I am also facing same problem(issues#284) with iframe. I have tried as you have mentioned "c.NotebookApp.tornado_settings". It didn't work.
I have tried both way:
The text was updated successfully, but these errors were encountered: