When the host is something like '[::1]' or '[::1]:8080',
_get_host_handlers gets wrong hosts string.
self.transforms.append(transform_class)
def _get_host_handlers(self, request):
- host = request.host.lower().split(':')[0]
+ host = request.host.lower()
+ if not host.endswith(']'): # excluding IPv6 addresses without port
+ host = host.rsplit(':', 1)[0]
matches = []
for pattern, handlers in self.handlers:
if pattern.match(host):