Skip to content

Commit

Permalink
We have seen these errors:
Browse files Browse the repository at this point in the history
ERROR:tornado.general:Attempted to attach to session 7ceo057h (::1) from different IP (127.0.0.1)
ERROR:tornado.general:Attempted to attach to session 60qsy81d (127.0.0.1) from different IP (::1)
Normalize the ipv6 to ipv4 expression of localhost.
  • Loading branch information
maparent committed May 29, 2016
1 parent a0a7e5d commit 5207cf7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sockjs/tornado/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5207cf7

Please sign in to comment.