diff --git a/sockjs/tornado/session.py b/sockjs/tornado/session.py index 95e2edf..57d3efe 100644 --- a/sockjs/tornado/session.py +++ b/sockjs/tornado/session.py @@ -267,7 +267,8 @@ def set_handler(self, handler, start_heartbeat=True): if self._verify_ip and self.conn_info is not None: # If IP address doesn't match - refuse connection - if handler.request.remote_ip != self.conn_info.ip: + localv6 = lambda ip: '127.0.0.1' if ip == '::1' else ip + if localv6(handler.request.remote_ip) != localv6(self.conn_info.ip): LOG.error('Attempted to attach to session %s (%s) from different IP (%s)' % ( self.session_id, self.conn_info.ip,