Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite malformed root url #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

juzdzema
Copy link

Fixes #121

@guimou
Copy link

guimou commented Mar 24, 2022

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

@guimou guimou mentioned this pull request Mar 25, 2022
@lucianolacurcia
Copy link

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

@ryanlovett
Copy link
Collaborator

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
Copy link

@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
Copy link

guimou commented Sep 13, 2022

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
Copy link
Collaborator

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

@ryanlovett
Copy link
Collaborator

@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
Copy link

mathematicalmichael commented Sep 19, 2022

@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
Copy link
Contributor

I think #144 is related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not working behind a reverse proxy
6 participants