title: What is the correct way to "end" a request from express/connect middleware?
body: <p>Assuming I have middleware such as this;</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  app.use(function (req, res, next) {
      var host = "example.com";
  
      if (req.host !== host) {
          res.redirect(301, host + req.originalUrl);
          res.end();
      }
  });
  </code></pre>
  
  <p>What sort of rules do I need to abide by here?</p>
  
  <ol>
  <li>Should I be calling <code>res.end()</code>? (or does <code>res.redirect()</code> do this for me?)</li>
  <li>Should I be calling <code>next()</code>? (or does connect detect the request has ended and exit cleanly?)</li>
  <li>Assuming that I <em>should</em> be calling <code>next()</code>, I guess that means <em>I</em> can potentially be receiving requests to my middleware which may have already been ended by other middleware higher in the chain; how do I protect myself against this?</li>
  </ol>