Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Report correct clientIp when using reverse/forward-proxies

  • Loading branch information...
commit 38da2b096b43adbb2a814d94bd0ff6eda060d5c3 1 parent e6d4094
Sveinung Røsaker sveisvei authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  src/websocket/transports/socketio/index.coffee
3  src/websocket/transports/socketio/index.coffee
View
@@ -35,6 +35,9 @@ module.exports = (ss, emitter, httpServer, config = {}) ->
try
[responderId, content] = utils.parseWsMessage(msg)
clientIp = socket.manager.handshaken[socket.id].address.address
+ if socket.manager.handshaken[socket.id].headers['x-forwarded-for']
+ clientIp = socket.manager.handshaken[socket.id].headers['x-forwarded-for'].split(',')[0]
+
meta = {socketId: socket.id, sessionId: socket.sessionId, clientIp: clientIp, transport: 'socketio'}
emitter.emit responderId, content, meta, (data) ->
socket.send(responderId + '|' + data)
Please sign in to comment.
Something went wrong with that request. Please try again.