-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Labels
Description
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.
def rewrite_auth(response, request):
'''
As of rstudio-server 1.4ish, it would send the client to /auth-sign-in
rather than what the client sees as the full URL followed by
/auth-sign-in. See rstudio/rstudio#8888. We rewrite the response by
sending the client to the right place.
'''
for header, v in response.headers.get_all():
if header == "Location":
# Visit the correct page VM 211222
if ", " in urlparse(v).netloc:
u = urlparse(v)
u = u._replace(scheme='https')
u = u._replace(netloc=u.netloc.split(",")[0])
response.headers[header] = urlunparse(u)
elif v.startswith("/auth-sign-in"):
# Visit the correct page
u = urlparse(request.uri)
response.headers[header] = urlunparse(u._replace(path=u.path+v))