Base_url bug running Panel behind Jupyter Server Proxy?

I have this binder repo that installs a Jupyter server extension which uses Jupyter Server Proxy to run a Panel app: GitHub - NyanCAD/Pyttoresque-templates: Notebook templates for Pyttoresque simulations which defines the following entrypoints: Pyttoresque/setup.py at f90b73cda703daf5c6c88af41e77d3e5bf7ff284 · NyanCAD/Pyttoresque · GitHub which is defined here Pyttoresque/__init__.py at f90b73cda703daf5c6c88af41e77d3e5bf7ff284 · NyanCAD/Pyttoresque · GitHub

This all works great running locally and with repo2docker, but on Binder whatever/panel gives a 404.

The way it’s set up is that I’ve configured Jupyter Server Proxy to pass the full URL to Panel, and pass the Jupyter {base_url}/panel as the --prefix to Panel. This is needed so that Panel can find all its resources and not cause a wrong redirect.

My hunch is that the base_url doesn’t properly make it through to Panel, but since it works locally and I can’t check the logs on mybinder.org it is kind of hard to debug. Any ideas?

JupyterLab (and notebook) can be run locally under a prefix:

$ jupyter-lab --help-all

...
--ServerApp.base_url=<Unicode>
    The base URL for the Jupyter server.
                           Leading and trailing slashes can be omitted,
                           and will automatically be added.
    Default: '/'
$ jupyter-notebook --help-all

...
--NotebookApp.base_url=<Unicode>
    The base URL for the notebook server.
                                   Leading and trailing slashes can be omitted,
                                   and will automatically be added.
    Default: '/'

Is your problem reproducible that way?

Note it’s actually slightly more complicated, since JupyterLab can be run on top of Jupyter-notebook as well as jupyter-server, so also try both combinations if it’s not reproducible.

Thanks! Looking at the logs it was obvious there was a // because of doing {base_url}/panel, removing the slash seems to fix it. I hope that’s always the case though, or will I end up with basepanel now in other cases haha

1 Like

base_url is always guaranteed to both start and end with slash, so you should always be able to do {base_url}panel to get the right absolute path.