Skip to content

Commit 8745364

Browse files
authored
Improve local URL detection
IPv4 loopback is 127/8, so treat entire range as local.
1 parent 4ee6e1d commit 8745364

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jupyter_server/serverapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2377,7 +2377,7 @@ def local_url(self) -> str:
23772377
parts = self._get_urlparts(include_token=True)
23782378
# Update with custom pieces.
23792379
if not self.sock:
2380-
localhost = "[::1]" if ":" in self.ip else "127.0.0.1"
2380+
localhost = "[::1]" if ":" in self.ip else self.ip if self.ip.startswith("127.") else "127.0.0.1"
23812381
parts = parts._replace(netloc=f"{localhost}:{self.port}")
23822382
return parts.geturl()
23832383

0 commit comments

Comments
 (0)