fix(run_websocket.py): remote IP get bug

when use nginx  self.request.headers.get(X-Real-IP) will get real remote IP,
self.request.remote_ip will get 127.0.0.1 ; if not it will git null, so need to use
self.request.remote_ip for get the ip
pull/94/head
liuzheng712 9 years ago
parent 0b9b94bc0b
commit 5098b1c696

@ -317,6 +317,8 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self.term = WebTty(self.user, asset, login_role, login_type='web')
# self.term.remote_ip = self.request.remote_ip
self.term.remote_ip = self.request.headers.get("X-Real-IP")
if not self.term.remote_ip:
self.term.remote_ip = self.request.remote_ip
self.ssh = self.term.get_connection()
self.channel = self.ssh.invoke_shell(term='xterm')
WebTerminalHandler.tasks.append(MyThread(target=self.forward_outbound))

Loading…
Cancel
Save