Getting URLs re-written unexpectedly

I didn’t notice this last week, but I’m suddenly getting URL rewrites that are unexpected and breaking for Jupyter Lab. We are not seeing the same issues with Jupyter Notebooks, RStudio Server, Ansys or Matlab.

When creating a Jupyter lab, the interface is injecting an /auto-[A-Za-z]/ between the host and /node/?

IE, the config and the link on the interactive sessions page looks like:

https://ood.company.com/node/k243/46335/lab?clone

But it is now redirecting to https://ood.company.com/auto-H/node/k243/46335/lab?clone

Manually removing the inserted doesn’t work because it just re-directs again.

I swear this was working last week. To my knowledge, I’ve not changed anything in that time?

in view.html.erb we have <form action="/node/<%= host %>/<%= port %>/login" method="post" target="_blank">

In templates/script.sh.erb we have
jupyter <%= context.jupyterlab_switch == "1" ? "lab" : "notebook" %> --config="${CONFIG_FILE}" --notebook-dir="<%= working_dir %>"

and form.yml has

jupyterlab_switch:
  widget: "check_box"
  checked_value: 1
  unchecked_value: 0
  value: 0
  label: Use JupyterLab instead of Jupyter Notebook?
  help: |
    JupyterLab is the next generation of Jupyter

Notebooks are working fine, completely as expected. The module has
python 3.8.3,
jupyter 1.0,
jupyterlab 2.2.0.

The OS is CentOS 8.2,
OnDemand 1.7.14,
httpd 2.4.37,
nginx 1.14.1

EDIT:

  1. At least one user is reporting that they are not seeing this? I’ve restarted the OOD server, so there must be something wrong in my personal directory?
  2. If I hand re-write the URL to be something like what I’d expect from a Notebook, it works?! ie
    https://ood.company.com/auto-H/node/k243/46335/lab?clone <- 404
    https://ood.company.com/node/k243/46335/tree <- works

What’s your host_regex configuration in ood_portal.yml? And do you run Jupyterlab with the --NotebookApp.base_url parameter?

Jupyterlab does this redirection to create a new workspace and generally it works OK, (with the exception of Safari users which you can see here how we handle that.

host_regex: 'k\d{3}'

And no, afaict we don’t use that parameter - it’s just as I noted above - in the templates/script.sh.erb, right?

I’m on Ubuntu 20.04 with Firefox and Chromium so it’s not a Safari issue.

If that regex works, than it’s OK, so that’s not it.

You may need something like the parameter we use.

Yep, 99% of my installation is copy/pasted :slight_smile:

I think that the problem is in Python/Jupyter itself - I’m seeing the JupyterLab title in the browser before the redirect. The redirect is happening inside JupyterLab I think. Thanks. I’ll keep hunting.