diff --git a/lib/browserid/http_forward.js b/lib/browserid/http_forward.js index 3eec38ed9b127280b6ed2a39f892e8930f7c095a..5db137c2c8720ecca9e19913e29630d6fed93ecf 100644 --- a/lib/browserid/http_forward.js +++ b/lib/browserid/http_forward.js @@ -16,14 +16,14 @@ module.exports = function(dest, req, res, cb) { path: u.pathname, method: req.method }, function(pres) { - var hdrs = {}; - [ 'access-control-allow-origin', 'content-type', 'content-length' ].forEach(function(key) { - if (pres.headers.hasOwnProperty(key)) { - hdrs[key] = pres.headers[key]; - } - }); - res.writeHead(pres.statusCode, hdrs); - + res.statusCode = pres.statusCode; + // forward along Content-Type and Content-Length, if available + if (pres.headers.hasOwnProperty('content-type')) { + res.setHeader('Content-Type', pres.headers['content-type']); + } + if (pres.headers.hasOwnProperty('content-length')) { + res.setHeader('Content-Length', pres.headers['content-length']); + } pres.on('data', function (chunk) { res.write(chunk); }).on('end', function() {