mirror of https://github.com/jumpserver/jumpserver
fix: 优化 endpoint 的 ipv6 支持
parent
d2eacad97b
commit
e812e3ff89
|
@ -131,5 +131,11 @@ class EndpointRule(JMSBaseModel):
|
||||||
endpoint = Endpoint.get_or_create_default(request)
|
endpoint = Endpoint.get_or_create_default(request)
|
||||||
if not endpoint.host and request:
|
if not endpoint.host and request:
|
||||||
# 动态添加 current request host
|
# 动态添加 current request host
|
||||||
endpoint.host = request.get_host().split(':')[0]
|
host_port = request.get_host()
|
||||||
|
# IPv6
|
||||||
|
if host_port.startswith('['):
|
||||||
|
host = host_port.split(']:')[0].rstrip(']') + ']'
|
||||||
|
else:
|
||||||
|
host = host_port.split(':')[0]
|
||||||
|
endpoint.host = host
|
||||||
return endpoint
|
return endpoint
|
||||||
|
|
Loading…
Reference in New Issue