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

Rewrite malformed root url #124

Open juzdzema opened 2 years ago

juzdzema commented 2 years ago

Fixes #121

guimou commented 2 years ago

Definitely solved the problem in my case where I was redirected to https://jupyterhub/user/userid/rstudio (no more original full host location).

lucianolacurcia commented 2 years ago

Is this merged? I am facing the same problem in openshift 4

ryanlovett commented 2 years ago

Thanks for the PR @juzdzema and everyone for their feedback and patience. It is somewhat surprising that this fix works since it replaces the check for /auth-sign-in. This suggests that in your environments, RStudio never sends users to that path, yet another kind of mangling is happening. In my environment and in most others I've deployed to, we definitely do see the /auth-sign-in issue. So I suspect this PR may not work for me, but I need to test.

For those reverse proxying, can you please let me know how you're configuring the hub? Are your configs anything like what jupyterhub recommends at https://jupyterhub.readthedocs.io/en/stable/reference/config-proxy.html ?

lucianolacurcia commented 2 years ago

@ryanlovett

I am using community version of RStudio and deployed Jupyterhub in Openshift 4.

Every config is default in Jupyterhub. (no reverseproxy config)

For me being able to use binder r-image under this deployment I have to build the image using repo2docker on binder-example template and at the postBuild stage I uninstall the default jupyter-rsession-proxy and install it again but now using @juzdzema patch. If you want to try this PR in your environment maybe you can try this.

Thanks!

guimou commented 2 years ago

If that helps, this is my config that works for JupyterHub deployed on OpenShift as part of Open Data Hub: https://github.com/guimou/custom-notebooks/blob/main/jupyterhub-images/r-notebook/container/jupyter-rsession-proxy/jupyter_rsession_proxy/__init__.py

ryanlovett commented 2 years ago

@lucianolacurcia I can confirm that the latest version of jupyter-rsession-proxy and jupyter-server-proxy does not work on mybinder.

ryanlovett commented 2 years ago

@juzdzema I'm trying to identify cases that jupyter-rsession-proxy needs to handle, and what may be incorrect reverse proxy configurations. It seems that what may work for some may not impact, or may break others. If it is not possible to identify or correct root causes, then the long term solution may be to include multiple rewrite_ functions (including the one here), and then enable hub admins to easily enable those that fix their particular deployments.

I haven't been able to reproduce your issue, though I was able to reproduce and fix another. The fix is similar to yours in #124, but that wouldn't have worked for this latter case since request.host was contained within the header value, as a substring.

In the meantime, can you please share your reverse proxy configuration? Can you also please let me know the behavior if you install the latest version of jupyter-server-proxy?

mathematicalmichael commented 2 years ago

@ryanlovett user behind reverse proxy here.

not sure if I'm testing this PR quite right but I tried adding this to the bottom of my image

RUN python3 -m pip install git+https://github.com/juzdzema/jupyter-rsession-proxy@e5bb37dcdb469688e2dd838bd55c2c082681e7e9

to install the changes on this PR and found I was still being mis-directed.

I'm running cloudflare tunnels as my reverse proxy, just telling it the docker IP / internal port and letting it handle the rest.

I encountered this when trying to do my occasional upgrade to the RStudio image / jupyterhub version; RStudio's changes are always the most challenging part it seems... (it was already enough of a surprise to find out the config file for jupyter_server_proxy changed as well).

yuvipanda commented 4 months ago

I think https://github.com/jupyterhub/jupyter-rsession-proxy/issues/144 is related