Skip to content

Commit b75f082

Browse files
authored
Send user to custom URL
Send user to configured custom URL upon launch, instead of one constructed from bound IP address.
1 parent 4ee6e1d commit b75f082

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

jupyter_server/serverapp.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,9 +2359,9 @@ def _get_urlparts(
23592359
)
23602360
return urlparts
23612361

2362-
@property
2363-
def public_url(self) -> str:
2364-
parts = self._get_urlparts(include_token=True)
2362+
def _customize_url(
2363+
self, parts: type[urllib.parse.ParseResult]
2364+
) -> urllib.parse.ParseResult:
23652365
# Update with custom pieces.
23662366
if self.custom_display_url:
23672367
# Parse custom display_url
@@ -2370,6 +2370,12 @@ def public_url(self) -> str:
23702370
custom_updates = {key: item for key, item in custom.items() if item}
23712371
# Update public URL parts with custom pieces.
23722372
parts = parts._replace(**custom_updates)
2373+
return parts
2374+
2375+
@property
2376+
def public_url(self) -> str:
2377+
parts = self._get_urlparts(include_token=True)
2378+
parts = self._customize_url(parts)
23732379
return parts.geturl()
23742380

23752381
@property
@@ -2394,6 +2400,7 @@ def display_url(self) -> str:
23942400
@property
23952401
def connection_url(self) -> str:
23962402
urlparts = self._get_urlparts(path=self.base_url)
2403+
urlparts = self._customize_url(urlparts)
23972404
return urlparts.geturl()
23982405

23992406
def init_signal(self) -> None:

0 commit comments

Comments
 (0)