I’m using ProxyHandler from jupyter-server-proxy.handlers in order to proxy requests in a web server that I have built. I want to configure it to proxy to remote locations by configuring c.ServerApp.allow_remote_access = True in ~/.jupyter/jupyter_server_config.py, but it always ends up being false and jupyter-server-proxy throws a 403. I verified that jupyter-server outputs the configuration that I created when I call jupyter-server --Application.show_config=true, same for jupyter-server --ServerApp.show_config=true and jupyter-server --JupyterApp.show_config=true
Is this the right way to configure jupyter-server-proxy in this particular instance?
jupyter-server-proxy is an extension, so it has it’s own set of configuration properties, c.ServerApp.allow_remote_access only affects the jupyter-server component.
In your title you’ve said it’s “imported as a Python library”. Can you explain a bit more, or share your code? Are you developing your own extension, or are you just importing it in a standalone script?
see this code. It’s being used to optionally integrate proxying into a web server. The code I’m talking about is actually in the dask.distributed python library.
Is it only possible to configure this by updating the host_allowlist, as in c.ServerProxy.host_allowlist = ['x']? in .jupyter/jupyter_notebook_config.py?
jupyter-server-proxy uses traitlets for configuration. Classes don’t automatically load their configuration from a file though, this has to be done explicitly.
Typically this is done in the main application, which then passes the configuration to other classes when they’re instantiated. Is this what you’re doing in dask.distributed?
If you’re not, you might be able to get away with just passing in host_allowlist=... when you construct the class:
Though from past experience things can get a bit hairy when you’re messing with traitlets derived classes. Probably no harm trying though
I’m running into this same issue. The docs for jupyter-server-proxy say to update the host_allowlist option in your configuration. But I can’t really figure out where that is.
My initial reaction was to create ~/.jupyter/jupyter_notebook_config.py with the contents c.ServerProxy.host_allowlist = ["x"] but that doesn’t seem to have taken effect.
Hey @jacobtomlinson, you can also use jupyter_server_config.py—which replaced jupyter_notebook_config.py.
I believe, if you have nbclassic enabled (a new package that we’re using to help with the transition from the classic Notebook to JupyterLab), it should automatically shim the jupyter_notebook_config.py settings to proper place. I’d be curious to know if that’s not working…
Thanks for getting back to me @Zsailer! I can import nbclassic so I guess that’s installed, but yeah it didn’t seem to pick up jupyter_notebook_config.py but did pick up jupyter_lab_config.py.
I can easily change is to jupyter_server_config.py which seems to make more sense, is that what you would recommend?