Skip to content

Commit ceded53

Browse files
committed
Do not append the Location path to the whole uri.
1 parent 3959b1c commit ceded53

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jupyter_rsession_proxy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import subprocess
66
import tempfile
77
from textwrap import dedent
8+
from urllib.parse import urlparse, urlunparse
89

910

1011
def get_rstudio_executable(prog):
@@ -39,7 +40,8 @@ def rewrite_auth(response, request):
3940
for header, v in response.headers.get_all():
4041
if header == "Location" and v.startswith("/auth-sign-in"):
4142
# Visit the correct page
42-
response.headers[header] = request.uri + v
43+
u = urlparse(request.uri)
44+
response.headers[header] = urlunparse(u._replace(path=u.path+v))
4345

4446
def setup_rserver():
4547
def _get_env(port):

0 commit comments

Comments
 (0)