Configure JupyterHub deployment to have multiple base urls

Hi all,

I’m trying to configure JupyterHub deployment to be accessible from 2 different urls (with same subdomains, but different paths). e.g. from <path>/<to>/<myapp>/jupyter and from foobar.<path>/jupyter.

I see that this is controlled by the combination of ingress + hub’s baseUrl. I can add new rules for the ingress, but this only helps in either of the case, and not both.

Accessing the latter (foobar.<path>/jupyter) fails with Service unavailable after adding new rule for the ingress.

Is there a way to achieve this?

We use proxy with chp and service type of ClusterIp. Happy to provide other details.

Logs from proxy pod for failure case:

00:30:37.347 [ConfigProxy] error: 503 GET /jupyter/hub/api connect EHOSTUNREACH 10.105.160.174:80
00:30:37.352 [ConfigProxy] error: Failed to get custom error page: Error: connect EHOSTUNREACH 10.105.160.174:80
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -113,
  code: 'EHOSTUNREACH',
  syscall: 'connect',
  address: '10.105.160.174',
  port: 80
}

As you have rightly said, you can use ingress rule to direct traffic from foobar.<path>/jupyter to <path>/<to>/<myapp>/jupyter and configuring /jupyter as base URL for JupyterHub. It should work. If it is not working, it must an issue with ingress rule?

If you mean you want two client-facing baseUrls for the same JupyterHub (https://example.org/prefix-a, https://example.org/prefix-b) that’s not possible, JupyterHub needs to be configured with the baseUrl seen by the browser so it can generate URLs in web pages. Other Jupyter components such as JupyterLab also need to know their base URL when they’re launched.

Thanks for the reply! But this seems to be a genuine case that same app can be accessed by 2 client facing URLs and proxy just needs to add more routes to handle the requests coming for the new base URL ?

The proxy just passes requests straight through to JupyterHub or the singleuser servers so it’s not as simple as adding more routes to the proxy. The applications behind the proxy also need to understand the baseUrl.

If you need to run JupyterHub under a single domain but with multiple baseUrls you can run multiple JupyterHubs. I can’t remember if you need to add some configuration to prevent the cookies from multiple hubs conflicting.

1 Like