Skip to content

Commit 6880f01

Browse files
committed
If ServerApp.ip is ipv6 use [::1] as local_url
1 parent dd7daf9 commit 6880f01

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jupyter_server/serverapp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2377,7 +2377,11 @@ def local_url(self) -> str:
23772377
parts = self._get_urlparts(include_token=True)
23782378
# Update with custom pieces.
23792379
if not self.sock:
2380-
parts = parts._replace(netloc=f"127.0.0.1:{self.port}")
2380+
if ":" in self.ip:
2381+
localhost = "[::1]"
2382+
else:
2383+
localhost = "127.0.0.1"
2384+
parts = parts._replace(netloc=f"{localhost}:{self.port}")
23812385
return parts.geturl()
23822386

23832387
@property

0 commit comments

Comments
 (0)