-
Notifications
You must be signed in to change notification settings - Fork 88
X-Forwarded-Proto header causes 404 with rstudio server 1.4 #97
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
Comments
@ryanlovett Is it possible to turn off authentication in Rstudio as used to be possible to get around this issue? I rely on jupyterhub for authentication so don't need it from Rstudio as well. |
@vnijs We do set rstudio's --auth-none flag and one doesn't need to actually authenticate to rstudio, but rserver initiates this redirect flow anyways. We only notice because it is sending the user to the wrong place. |
Is this perhaps something to create an issue about at https://github.com/rstudio/rstudio/issues? I might also be able to check with Rstudio support directly if you think that would be a better option. |
@vnijs Yes, see rstudio/rstudio#8888. |
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: |
For me, the potential workaround mentioned in the first post leads to |
Hello, Carrying on my investigations from #93, with the flag I've forked this repo and am messing around on my fork here - I've changed the line
to
and rebuilt my image and attempted to launch Rstudio from the The result is the same whether I launch via localhost docker or jupyterhub kubernetes. I get redirected to this uri.
or
Respectively. Next I'll try this approach - rstudio/rstudio#2834 (comment) And see if it helps. |
Building my image with the line
changed to
Results - On localhost, clicking launcher takes me to -
On jupyterhub, clicking launcher takes me to -
Looking at the Rstudio source code, the Basically, it looks to me (a lowly data scientist) that the appUri is not being set.
I've noticed a pull request from @zeehio that just came through; off the back of that I'll try |
I have not tested @zeehio 's solution |
As of v1.4 of this extension, we are working around this issue. I'd like to leave it open to help track the upstream progress. I think we'll close this when the workaround is no longer necessary. |
Great to hear of progress, many thanks Ryan. I would be interested in seeing details of the work-around and ideas on making the work-around unnecessary, especially as I am hoping to use Binder/RStudio for teaching from September 2021. |
The workaround is fairly simple: When you visit /rstudio this happens:
If you visit the /rstudio/auth-sign-in page the following happens:
Before our workaround, the only way to open rstudio successfully was to manually type and visit the auth-sign-in endpoint because of the broken redirection in /rstudio. After our workaround, the RStudio button in jupyter will always take you to the correct auth-sign-in page. We have always had the RStudio authentication disabled here (because auth has been taken care by jupyter already) so you won't ever see the login page and you will be redirected to RStudio transparently. The workaround won't be necessary if the RStudio folks fix the issue. However it is not a big deal to maintain it, in my opinion. |
I'm having trouble getting the workaround described by @zeehio to function on my JupyterHub. Does anyone have any tips, please? (The Hub is running on Google Cloud and it's based on the Zero2JupyterHub tutorial). I was originally experiencing the problem exactly as described @ryanlovett in the first post of this thread. The issue initially occurred both on my cloud-based JupyterHub and when testing locally using Docker (i.e. launching a container and accessing JupyterHub on localhost). Upgrading
and see a 404 error. If I manually enter the URL as
everything works fine for the rest of the session, but I'd like to avoid asking all my users to do this each time if possible. Upgrading to 1.4 and adding the environment variable seems to have almost solved the problem, but there's still something I'm missing. Can anyone point me in the right direction, please? Thanks! |
As far as I can recall in the pull requests that were merged it is mentioned that the workaround currently works for the jupyter menu, but it does not work for the jupyterlab icons because we don't have the JavaScript experience to fix it there |
Ah, OK - thanks for the lightning fast response @zeehio! Interesting that it fixes the problem with JupyterLab running locally, though. I'll take a look at the pull requests for more details. Cheers! |
I had the same issue, but I have it working now on my Zero to Jupyterhub GKE cluster.
IN MY CONFIG.YAML |
@erniee I haven't tested your Dockerfile on my cluster, but I think your solution will work for anyone wanting to start R-Studio by default 👍 In my case, I'd like to use JupyterLab by default, but then have the option of starting R-Studio by clicking the button in the JupyterLab launcher menu. If you change your Great that it's working for your use case though! |
Hi all, Could you please try out #107 if convenient? It should work in both lab and notebook as it doesn't rely on the modified launcher. You should be able to |
This is working now for me - please see my comment on the PR. Many thanks @ryanlovett! |
I was facing the same issue in z2jh on k8s and its working now with below config in Ingress
|
The version of RStudio we were deploying is too old for R 4.1's graphics engine, causing this error: > R graphics engine version 14 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed. So we pin R to 4.0 until we can resolve that. The underlying issue is tracked in jupyterhub/jupyter-rsession-proxy#97
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: |
Addressed by #110. We'll make a new release shortly. |
As mentioned in #95.
If the HTTP header X-Forwarded-Proto is being set, such as by a proxy, rstudio-server will redirect users to /auth-sign-in?appUri=%2F rather than the full {base_url}/auth-sign-in?appUri=%2F. This will usually cause a 404. You can observe this behavior on mybinder.org for example, whereas it probably is not present on localhost.
I created rstudio/rstudio#8888, however I don't see anything in rstudio's code that would cause this behavior. Perhaps we're not invoking rserver with the right combination of options.
When presented with the 404, a user can manually work around the problem by inserting the base path in front of the auth-sign-in path. For example on a jupyterhub, the user could change /auth-sign-in?appUri=%2F to /user/the-user-name/rstudio/auth-sign-in?appUri=%2F. Once corrected, rserver will properly authenticate the user and the user will be redirected to {base_url}/rstudio. Obviously we don't want the user to have to do this, but this observation helps to describe the problem.
If we remove the header from the HTTP request, the Location header returned by rstudio server uses http protocol and has the correct path. So this might not be appropriate on https sites. If we intercede and set the value of the header to https instead of https,http, the header value uses https:// rather than http://.
The argument against filtering out the header is that if rserver ever requires https, not having the header could lead to a redirect loop. I found a nice explanation of this.
@manics also described past experience with the header.
We might be able to workaround this issue by setting our url to /rstudio/auth-sign-in?appUri=%2F instead of /rstudio. If you've already been authenticated by rserver, then this just takes the user back to /rstudio/. I'd have to experiment but I think it'd work just fine.
The text was updated successfully, but these errors were encountered: