[CB-1494] weinre - Supports running server behind a proxy, such as Heroku Cedar
https://issues.apache.org/jira/browse/CB-1494
Easiest thing to do is just neuter the remote address check in
the getChannel() function in the weinre.server/lib/channelManager.coffee
source file.
All this provided before was a simplistic check to make sure the
requests always were coming from the same remote address; for
someone who wanted to cheat, there were ways of cheating, and so
still are. For everyone else, you can now run under proxy servers
transparently.
diff --git a/weinre.doc/ChangeLog.body.html b/weinre.doc/ChangeLog.body.html
index 2c0a98c..3bbbcf0 100644
--- a/weinre.doc/ChangeLog.body.html
+++ b/weinre.doc/ChangeLog.body.html
@@ -52,6 +52,7 @@
<li><a href="https://issues.apache.org/jira/browse/CB-1759">CB-1759</a> - doc indicates that you should launch weinre with a command prefix of `node`
<li><a href="https://issues.apache.org/jira/browse/CB-1193">CB-1193</a> - add Windows Phone support
<li><a href="https://issues.apache.org/jira/browse/CB-1800">CB-1800</a> - remove references to "incubator"
+<li><a href="https://issues.apache.org/jira/browse/CB-1494">CB-1494</a> - Supports running server behind a proxy, such as Heroku Cedar
</ul>
<!-- ======================================================================= -->
diff --git a/weinre.server/lib/channelManager.coffee b/weinre.server/lib/channelManager.coffee
index 48abca6..d55bb01 100644
--- a/weinre.server/lib/channelManager.coffee
+++ b/weinre.server/lib/channelManager.coffee
@@ -39,7 +39,7 @@
WeinreClientEvents = serviceManager.get 'WeinreClientEvents'
WeinreTargetEvents = serviceManager.get 'WeinreTargetEvents'
-
+
if !WeinreClientEvents
utils.exit 'WeinreClientEvents service not registered'
@@ -49,7 +49,7 @@
#---------------------------------------------------------------------------
created: (channel) ->
@channels[channel.name] = channel
-
+
#---------------------------------------------------------------------------
destroyed: (channel) ->
if channel.isClient
@@ -58,44 +58,44 @@
else
for connection in channel.connections
@disconnectChannels(connection, channel)
-
+
clients = @getClientChannels(channel.id)
- if channel.isClient
+ if channel.isClient
WeinreClientEvents.clientUnregistered(clients, channel.name)
else
WeinreClientEvents.targetUnregistered(clients, channel.name)
- delete @channels[channel.name]
+ delete @channels[channel.name]
#---------------------------------------------------------------------------
getChannel: (name, remoteAddress) ->
return null if !_.has(@channels, name)
-
+
channel = @channels[name]
return null if !channel
-
- if remoteAddress
- return null if channel.remoteAddress != remoteAddress
-
+
+# if remoteAddress
+# return null if channel.remoteAddress != remoteAddress
+
channel
#---------------------------------------------------------------------------
connectChannels: (client, target) ->
return if client.isClosed or target.isClosed
-
+
if client.connections.length
@disconnectChannels(client, client.connections[0])
-
+
client.connections.push target
target.connections.push client
-
+
clients = @getClientChannels(client.id)
WeinreClientEvents.connectionCreated(clients, client.name, target.name)
WeinreTargetEvents.connectionCreated(target, client.name, target.name)
-
+
#---------------------------------------------------------------------------
disconnectChannels: (client, target) ->
@@ -106,7 +106,7 @@
client.connections = _.without(client.connections, target)
target.connections = _.without(target.connections, client)
-
+
#---------------------------------------------------------------------------
getChannels: (id) ->
if id?