Running a notebook behind jupyter-server-proxy

I have a jupyterhub where the single user servers have jupyter-server-proxy installed. How should a user access their own server using the proxy? I have tried jupyter notebook --NotebookApp.base_url=user/anton-akhmerov/proxy/8889, however because proxy strips the request URL prefixes, the notebook server itself responds with 404 on all requests. Is there a quick workaround?

Hi! When you say

How should a user access their own server using the proxy?

which server are you referring to, and how are you running it?

I mean an additional notebook server that they launch. To be more specific, I imagine the following scenario:

  • There’s a hub that people access using <hub_domain>/user/<username>
  • Within the hub, single user environments are derived from the jupyter docker stacks, and have a jupyter-server-proxy configured.
  • I consider a scenario where a user launches a jupyter notebook e.g. via terminal in their single user container, and would like to access it using the server proxy, which would give access to that notebook server at <hub_domain>/user/<username>/proxy/<port>.

maybe just need some more slashes?


Here’s a weird old post for running stuff in-kernel: NotebookApp.ipynb · GitHub

I should probably update it for jupyter_server anyhow, and adding proxy would be choice for actually getting at it.

Nope, that can’t be it:

    The base URL for the notebook server.
                                   Leading and trailing slashes can be omitted,
                                   and will automatically be added.

Also the proxy strips the entire prefix from the request URL, so client-side GET /user/anton-akhmerov/proxy/8889/ appears as GET / in the server logs.

Welp, then a look at the various config options, especially absolute_url, is probably in order: it may not be possible to do it with the “magic” port proxy, and instead needs a named one.

1 Like

For those that need a workaround, providing a full path to jupyterlab (jupyter lab --ServerApp.base_url="/user/anton-akhmerov/proxy/absolute/8889") and using the /absolute/ feature of the proxy does work.