diff --git a/lib/connect-force-domain.js b/lib/connect-force-domain.js index 120ebeb..33a90f9 100644 --- a/lib/connect-force-domain.js +++ b/lib/connect-force-domain.js @@ -4,14 +4,14 @@ * Inspired by rack-force_domain * */ - module.exports = function(domain){ - domain = domain || false; - return function(req, res, next){ - if (domain && (req.headers.host != domain)){ - res.writeHead(301, {"Location": 'http://' + domain + req.url}); - res.end(); - } - next(); - } + domain = domain || false; + return function(req, res, next){ + if (domain && (req.headers.host != domain)){ + res.writeHead(301, {"Location": 'http://' + domain + req.url}); + res.end(); + } else { + next(); + } + } };