-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
jupyterlab/jupyter-collaboration
#501Labels
Description
Description
When c.JupyterHub.subdomain_host
is set, the hubHost
variable passed to the frontend (JupyterLab/Notebook) includes the scheme as well (https://myhub.example.org
). However, the frontend expects hubHost
to be just the hostname (and optional port), without the scheme.
This can cause issues for frontend logic that constructs URLs or interacts with browser APIs requiring just the host.
To Reproduce
- Set
subdomain_host
in JupyterHub config:c.JupyterHub.subdomain_host = "https://myhub.example.org"
- Start JupyterHub and launch a single-user server.
- Inspect the
page_config
in the frontend (window.jupyterhub
orwindow.page_config_data
). Alternatively confirm thatJUPYTERHUB_HOST
env var contains the URL scheme. - Observe that
hubHost
is:instead of the expected:"hubHost": "https://myhub.example.org"
"hubHost": "myhub.example.org"
Expected behavior
hubHost
should contain just the hostname (and optional port), e.g.,myhub.example.org
, not includehttps://
.
Actual behavior
hubHost
contains the scheme, e.g.,https://myhub.example.org
.
Impact
- Frontend code that expects a host (not a full URL) may malfunction, causing URL construction errors, cookie issues, or broken redirects.
Proposed solution
-
When constructing
hubHost
for the frontend, strip the scheme and pass only the netloc/hostname part.from urllib.parse import urlparse parsed = urlparse(self.hub_auth.hub_host) page_config["hubHost"] = parsed.netloc or self.hub_auth.hub_host
Environment
- JupyterHub version: 5.3.0
- JupyterLab or Notebook version: 4.4.6
Additional context
- This issue can lead to subtle frontend bugs that are hard to track down. I found it by backtracking a bug in jupyterlab-collaboration.