From 6d074eff471fbe57ec6e763f03ae552d48578602 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 11 Mar 2015 00:33:34 -0700 Subject: [PATCH] fix "x-forwarded-proto" in node 0.12 and iojs The way to detect TLSSockets in node 0.12 and iojs has changed. You can just check `socket.encrypted` now :) Fixes #772 --- lib/http-proxy/passes/web-incoming.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js index b74e61a7e..9f5ec20e0 100644 --- a/lib/http-proxy/passes/web-incoming.js +++ b/lib/http-proxy/passes/web-incoming.js @@ -64,10 +64,11 @@ web_o = Object.keys(web_o).map(function(pass) { function XHeaders(req, res, options) { if(!options.xfwd) return; + var encrypted = req.isSpdy || req.connection.encrypted || req.connection.pair; var values = { for : req.connection.remoteAddress || req.socket.remoteAddress, port : common.getPort(req), - proto: req.isSpdy ? 'https' : (req.connection.pair ? 'https' : 'http') + proto: encrypted ? 'https' : 'http' }; ['for', 'port', 'proto'].forEach(function(header) {