How does `redirect_to_server=False` work?

Hi,
In the docs it is mentioned that by setting spawner.redirect_to_server = False we can redirect to arbitrary path like /services/service1 but when I do this in pre_spawner_hook it redirects the user to /user/username/services/service1
it still adds the URL to /user/username

spawner.redirect_to_server = False
spawner.default_url = f'/services/{selected_course}'

best

Spawner.default_url is relative to the user’s server. If you want to set the default path after login in to JupyterHub you can use JupyterHub.default_url instead.

1 Like

Is it global or can I set it for some specific users?

It didn’t seem to work:

hub:
  extraConfig:
    pre_spawner_hook: |

      #rest of code
      if is_instructor:
                  c.JupyterHub.default_url = f'/services/{selected_course}'

      # rest of code