Skip to content

Commit

Permalink
fix "x-forwarded-proto" in node 0.12 and iojs
Browse files Browse the repository at this point in the history
The way to detect TLSSockets in node 0.12 and iojs has changed. You can
just check `socket.encrypted` now :)

Fixes #772
  • Loading branch information
feross committed Mar 11, 2015
1 parent 9ece52f commit 6d074ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/http-proxy/passes/web-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6d074ef

Please sign in to comment.