Open victor-moreno opened 2 years 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.
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:
We encountered a similar behaviour with rstudio returning a malformed url (in our case the url gets stripped). For example, if we expect the url https://www.myhost-proxied.comp-any.org/user/userID/auth-sign-in/?appUri=%2F we actually get https://www.myhost/user/userID/auth-sign-in/?appUri=%2F.
We are behind a reverse proxy as well and in an Openshift context. In PR #124 we propose a general solution that should fix all kinds of root url problems (including that of the OP).
@juzdzema You're the real MVP! Thank you so much. I had seen this issue before as I was struggling with the same problem since a few weeks (redirected to http://jupyterhub/user/userid/...). I worked on something else, got back to it today, debugging different things and coming closer to what you did, but then had a quick check in the issues. And BAM! The solution was there. Please accept this small token of gratitude 🍻
In my case, it redirects to an URI that contains a (wrong) port specification:
https://jupyterhub....:80/user/.../rstudio/auth-sign-in?appUri=%2F
@moschlar I had the same issue, with jupyter-rsession-proxy v2.1.0 and jupyter-server-proxy v3.2.2, but my nginx reverse proxy was not configured like the recommendation at https://jupyterhub.readthedocs.io/en/stable/reference/config-proxy.html. After adjusting it to match the recommendation, the port addition problem went away.
@victor-moreno Regarding the rewrite, I suspect the rewriting will no longer be necessary due to changes merged for jupyter-server-proxy v3.2.2. I believe it is the hop-by-hop PR, but I haven't tested this yet. Can you please test with the latest releases of jupyter-rsession-proxy and jupyter-server-proxy? If you're still seeing the issue, can you please share your reverse proxy configuration?
@ryanlovett Hm, I just double-checked it, but it doesn't seem to make a difference... However, this is a z2jh instance which uses chp between my external reverse proxy and the hub/notebook itself... Maybe I need to dig there!
@moschlar Thanks for checking. The latest does not work on mybinder.org either. I don't know whether mybinder uses the recommended proxy configurations or not (it probably does), but I think that jupyter-rsession-proxy has to work on it regardless.
In my case, it redirects to an URI that contains a (wrong) port specification:
https://jupyterhub....:80/user/.../rstudio/auth-sign-in?appUri=%2F
I'm getting the same error with that environment.
jupyter-rsession-proxy==2.1.0
jupyter-server-proxy==3.2.2
I'm running a jupyterhub and using cloudflare tunnel as my reverse proxy so I don't exactly have the luxury of configuring nginx differently (per @ryanlovett ... not sure what the "adjustment" needed to be, nor whether I can make such a change).
Okay, thanks @mathematicalmichael ! Are you able to apply https://github.com/jupyterhub/jupyter-rsession-proxy/pull/134 to your environment?
edits to bottom of Dockerfile:
# RUN python3 -m pip install jupyter-rsession-proxy jupyter_server_proxy
RUN python3 -m pip install git+https://github.com/ryanlovett/jupyter-rsession-proxy@95759d85e95de6cb102702762d23f74ae2d46baa
fixed it!
thank you... had a bit of a time trying to figure out what the "solution" was amongst the discussions. The fast reply was much appreciated!!!
@mathematicalmichael Okay, great. That fixes it on binder as well. I'll merge soon.
:shipit:
Bug description
For some reason, with jupyterhub (v1.4.2 in docker), behind a reverse proxy, rstudio returns a malformed url, doubling the hostname separated by comma, like: "https://www.myhost.org%2C%20www.myhost.org/jupyter/user/victor/rstudio/auth-sign-in/?appUri=%2F" The %2C%20 is ", "
In case it helps someone with the same problem, I managed to get a working version with these changes to rewrite_auth. I never got redirected to /auth-sign-in, so the elif is there to keep current version, but is not needed in my setup.