mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-02 16:05:29 +00:00
fix: 优化 endpoint 的 ipv6 支持
This commit is contained in:
@@ -131,5 +131,11 @@ class EndpointRule(JMSBaseModel):
|
||||
endpoint = Endpoint.get_or_create_default(request)
|
||||
if not endpoint.host and request:
|
||||
# 动态添加 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
|
||||
|
Reference in New Issue
Block a user