Skip to content

Commit

Permalink
[fix] fixes #341
Browse files Browse the repository at this point in the history
  • Loading branch information
yawnt committed Dec 18, 2013
1 parent 03880d8 commit 97e4600
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/http-proxy/common.js
Expand Up @@ -73,3 +73,10 @@ common.setupSocket = function(socket) {

return socket;
};

common.getPort = function(req) {
var res = req.headers.host.match(/:(\d+)/);
return res ?
res[1] :
req.connection.pair ? '443' : '80' ;
}
2 changes: 1 addition & 1 deletion lib/http-proxy/passes/web-incoming.js
Expand Up @@ -65,7 +65,7 @@ web_o = Object.keys(web_o).map(function(pass) {

var values = {
for : req.connection.remoteAddress || req.socket.remoteAddress,
port : req.connection.remotePort || req.socket.remotePort,
port : common.getPort(req),
proto: req.isSpdy ? 'https' : (req.connection.pair ? 'https' : 'http')
};

Expand Down
2 changes: 1 addition & 1 deletion lib/http-proxy/passes/ws-incoming.js
Expand Up @@ -56,7 +56,7 @@ var passes = exports;

var values = {
for : req.connection.remoteAddress || req.socket.remoteAddress,
port : req.connection.remotePort || req.socket.remotePort,
port : common.getPort(req),
proto: req.connection.pair ? 'wss' : 'ws'
};

Expand Down

0 comments on commit 97e4600

Please sign in to comment.