diff --git a/lib/caronte/index.js b/lib/caronte/index.js index 4f4139d61..30db143f5 100644 --- a/lib/caronte/index.js +++ b/lib/caronte/index.js @@ -1,6 +1,6 @@ var caronte = exports, - web = require('./passes/web'); - ws = require('./passes/ws'); + web = require('./passes/web-incoming'); + ws = require('./passes/ws-incoming'); caronte.createWebProxy = createRightProxy('web'); caronte.createWsProxy = createRightProxy('ws'); diff --git a/lib/caronte/passes/web.js b/lib/caronte/passes/web-incoming.js similarity index 97% rename from lib/caronte/passes/web.js rename to lib/caronte/passes/web-incoming.js index c7a925d2e..6906ae873 100644 --- a/lib/caronte/passes/web.js +++ b/lib/caronte/passes/web-incoming.js @@ -91,7 +91,7 @@ function XHeaders(req, res, options) { function stream(req, res, options) { if(options.forward) { - var forwardReq = (options.target.protocol === 'https:' ? https : http).request( + var forwardReq = (options.forward.protocol === 'https:' ? https : http).request( common.setupOutgoing(options.ssl || {}, options, req, 'forward') ); req.pipe(forwardReq); diff --git a/lib/caronte/passes/web-outgoing.js b/lib/caronte/passes/web-outgoing.js index b0f86ce4d..4e981518b 100644 --- a/lib/caronte/passes/web-outgoing.js +++ b/lib/caronte/passes/web-outgoing.js @@ -9,11 +9,17 @@ var passes = exports; */ [ // <-- + + function writeStatusCode(res, proxyRes) { + res.writeHead(proxyRes.statusCode); + }, + function writeHeaders(res, proxyRes) { Object.keys(proxyRes.headers).forEach(function(key) { res.setHeader(key, proxyRes.headers[key]); }); } + ] // <-- .forEach(function(func) { passes[func.name] = func; diff --git a/lib/caronte/passes/ws.js b/lib/caronte/passes/ws-incoming.js similarity index 100% rename from lib/caronte/passes/ws.js rename to lib/caronte/passes/ws-incoming.js