From 44fbf5b55624138db62651619e66bd1f5a275637 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Mon, 23 Sep 2024 15:14:32 +0200 Subject: [PATCH] Correctly handle ipv6 localhost in Location --- panel/io/location.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panel/io/location.py b/panel/io/location.py index c895897abc..0fcafc4114 100644 --- a/panel/io/location.py +++ b/panel/io/location.py @@ -31,8 +31,10 @@ def _get_location_params(protocol: str|None, host: str| None, uri: str| None)->d if protocol: params['protocol'] = href = f'{protocol}:' if host: - if host.startswith("::ffff:"): - host = host.replace("::ffff:", "") + if host.startswith('::ffff:'): + host = host.replace('::ffff:', '') + elif host == '::1': + host = host.replace('::1', 'localhost') href += f'//{host}' if ':' in host: