Skip to content

Commit 38a67bc

Browse files
committed
Prefer IP address over hostname when available
1 parent 5cfba9c commit 38a67bc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

notebook/notebookapp.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,11 +1339,10 @@ def init_webapp(self):
13391339

13401340
@property
13411341
def display_url(self):
1342-
hostname = socket.gethostname()
1343-
if self.ip in ('localhost', '127.0.0.1', hostname):
1344-
ip = self.ip
1342+
if self.ip in ('', '0.0.0.0'):
1343+
ip = socket.gethostname()
13451344
else:
1346-
ip = hostname
1345+
ip = self.ip
13471346
url = self._url(ip)
13481347
if self.token:
13491348
# Don't log full token if it came from config

0 commit comments

Comments
 (0)