Jupyter Server Proxy on MyBinder

I’d like to use ungit (which works by starting a server on localhost) on MyBinder. This was nearly easy to do just using Jupyter Server Proxy, and I’m hoping there’s an obvious solution to the problem that presented.

When I start the local server on port 8448 using the Binder terminal and go to a URL that looks like this:

hub.gke2.mybinder.org/user/betatim-vscode-binder-2r07b6uj/proxy/8448

…the page title changes to ‘ungit’, indicating that it is connecting to the localhost server. However, the page resources don’t load. When I look at the console warnings, there are a bunch of 404 errors trying to load resources at URLs like

hub.gke2.mybinder.org/plugins/branches/branches.css

(to take one random CSS file as an example). I can manually adjust the URL to

hub.gke2.mybinder.org/user/betatim-vscode-binder-2r07b6uj/proxy/8448/plugins/branches/branches.css

and the CSS loads just fine. So what I need to do is to somehow convince the server to retain the /user/betatim-vscode-binder-2r07b6uj/proxy/8448/ part of the URL when it makes these requests. I assume this can be done by hacking the server code, but I’m wondering if there’s a more general and/or convenient solution.

Ungit looks pretty cool!

You’ll probably need to set the ‘rootPath’ config variable of ungit - see Support the use of a URL root path by geeklain · Pull Request #609 · FredrikNoren/ungit · GitHub.

You might need to setup a simple jupyter_notebook_config.json or a python package to provide the option - see jupyter-rsession-proxy/jupyter_rsession_proxy at 3c6e224c94ea75242f9f611990855375d845a100 · jupyterhub/jupyter-rsession-proxy · GitHubinit.py#L72 for an example.

Hope this helps!

Thanks, that is helpful.

Neither here nor there, but before receiving this response, I had just watched your talk about Jupyter Server Proxy, which I found to be excellent and really useful. I’m really very grateful for all of the things that you and your collaborators do to develop and sustain the Jupyter ecosystem!

This made me happy, thank you :slight_smile: