I configured the JupyterHub Dockerspawner.
I am able to run the JUPYTERHUB container without any issues and able to spawn the jupyter notebook container as well.
Here the problem is having with the content-security-policy.
“EvalError: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “default-src ‘self’ ‘unsafe-inline’ https: data:””
Here I am attaching the console section in (DevTools) screenshot of jupyter notebook which is spawned up from the JupyterHub.
Thanks @manics for giving the suggestion.
I tried with the following configuration in jupyter_notebook_config.py file. c.NotebookApp.tornado_settings={‘headers’: {‘Content-Security-Policy’: “default-src ‘self’ * ‘unsafe-inline’ ‘unsafe-eval’”}}
But still getting the same error: EvalError: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “default-src ‘self’ ‘unsafe-inline’ https: data:
Plugin ‘@jupyterlab/notebook-extension:kernel-status’ failed to activate.
Plugin ‘@jupyterlab/inspector-extension:notebooks’ failed to activate.
Like this all the libraries failed to activate.
Can you please suggest with the correct configuration either in jupyter_notebook_config.py or jupyter_server_config.py or provide any alternate solution for this?
It looks like you may be using curly/unicode open and close quotes- this often occurs if you copy and paste something, or if your editor autoformats quotes. Can you try using plain ("...", '...') quotes?
Can you show us what headers are being returned? This should be visible in the network tab of your browser console.
If the browser console network tab shows the expected Content-Security-Policy header but your browser is rejecting it perhaps there’s a syntax error or invalid parameter? This wouldn’t be related to JupyterHub, so if no-one else on this forum has a suggestion it could be worth asking on a web development forum instead?