jupyterhub / jupyter-rsession-proxy

Jupyter extensions for running an RStudio rsession proxy
BSD 3-Clause "New" or "Revised" License
118 stars 87 forks source link

rstudio does not work if url contains a dash (-) #140

Closed mattpollock closed 1 year ago

mattpollock commented 1 year ago

Bug description

See this discourse thread for context. The gist is that a url like something.mycompany.com will work fine. But something-else.mycomany.com will drop the -else when redirecting to /rstudio/auth-sign-in.

In some cases (including mine) the dash is long standing and removing it would be difficult for users and other applications.

welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

ryanlovett commented 1 year ago

Thanks for the report! Are you able to test with the master branch? It contains a different strategy for parsing the upstream location.

mattpollock commented 1 year ago

I tried by adding

git+https://github.com/jupyterhub/jupyter-rsession-proxy

to my requirements.txt file. My Dockerfile uses

RUN python3 -m pip install -r /tmp/requirements.txt

Unfortunately this did not resolve the issue. I'm using rocker/binder:4.3.0 as a base image. Please let me know if I'm installing the rsession-proxy correctly.

Thanks!

ryanlovett commented 1 year ago

Okay, thanks for testing. I'll try to reproduce on a local hub with - in the hostname.

ryanlovett commented 1 year ago

@mattpollock I've tested this on a couple of different hubs, each with - in the first element of the hostname, but unfortunately cannot reproduce. I've tried it on kubernetes (z2jh) and on HPC (batchspawner, configurable-http-proxy + nginx reverse proxy).

Do you happen to use a reverse proxy in front of your hub? Are you able to share its configuration?

mattpollock commented 1 year ago

Sorry for the delayed response. Thanks for digging into this. We're using a kubernettes spawner with the configurable-http-proxy. No nginx so far as I can tell.

ryanlovett commented 1 year ago

Okay, interesting. We've got it deployed on several z2jh hubs and have not been able to reproduce. Our pattern is foo.domainname and foo-staging.domainname and we don't see this issue on any of our -staging hubs. On a couple of those hubs we're using rocker/geospatial:4.2.2 as the base image. I can try to see if it is reproducible with newer versions, and perhaps with binder.

ryanlovett commented 1 year ago

I wasn't able to reproduce with an image based on rocker/geospatial:4.3.1. We don't use rocker/binder because it doesn't pin jupyter and friends. We basically try to re-use the same jupyter stack (packages and versions) on all the hubs on our k8s cluster. That being said, I'll see if I can deploy rocker/binder on a development hub.

Are your container manifests (Dockerfile, repo2docker, etc.) viewable in a public repo somewhere?

I tried deploying rocker/binder:4.3.0 on mybinder.org, and it worked, but the hostname was notebooks.gesis.org. (no dashes)

mattpollock commented 1 year ago

Interesting. I was using binder because of the jupyter integration. My dockerfile is inside a private org, so I can't share those. However maybe I can solve the problem by moving my base image to rocker/geospatial. Do you have any examples you can point me to for how you extend that to work with jupyter? All I'm doing right now is installing the following via pip

jupyterlab==3.3.2
jupyterhub==3.1.1
jupyterlab_widgets
ipywidgets
git+https://github.com/jupyterhub/jupyter-rsession-proxy
ryanlovett commented 1 year ago

Here is one image that adds jupyter to geospatial, https://github.com/berkeley-dsep-infra/datahub/blob/staging/deployments/stat20/image/Dockerfile.

I would think that if you're using the binder image as the base and also installing your list of pinned packages, that should be sufficient. My concern was that binder doesn't pin j-r-p or jupyterhub.

If version shuffling doesn't address the issue, then you might have to install a forked version where you add debugging to rewrite_netloc. That is the function that rewrites responses which is where I'd expect any accidental mangling to be happening.

mattpollock commented 1 year ago

Thanks Ryan, this is extremely helpful. I'll close this now and re-open if I it any other snags.