Proxy user to collaborative server

Hello Guys,

I wonder, is there a configuration in jupyterhub_config.py, which tell CHP to proxy a certain user to a collaborative Server?

In my Jupyerhub, every user has a group and a shared collaborative server. So, i want them to log into collborative server directly.

You can customize your spawner to do this job using default_url. I assume the shared collaborative server has a specific endpoint, so, for instance, if you want user foo to be routed to collaborative server, something like following in the start method of spawner:

def start(self):
    if self.user.name == 'foo':
        self.default_url = <colloborative server end point>
   return super().start()
1 Like

Hello mahendrapaipuri,

Thank you a lot for you answer. I have tried it, but there is still some problem.
my collaborative server (also collaborative account) names ‘workspace1’
if i set self.default_url = 'workspace1'
then nothing happens, spawner still redirect me to my own private server.

Could you share the entire URL that is in the browser when you access your collaborative server? workspace1 does not seems to be right. Maybe you are missing some path!

1 Like

of course!

https:example.org/jupyterhub/user/workspace1/lab

Alright, so you workspace1 is a named server? In that case you must modify the name of the server. So, instead of setting default_url, set self.name = 'workspace1'. So, something like this:

def start(self):
    if self.user.name == 'foo':
        self.name = 'workspace1'
   return super().start()
1 Like

Hello mahendrapaipuri,

thanks a lot! Your answer gives me inspirition!
spawner.default_url seems only add path after /hub/user/<user>/

I got it work with c.Jupyterhub.default_url. Details see another Topic:

1 Like