title: Node http-proxy and express
body: <p>I'm trying to do something like this:</p>
  
  <pre><code>// Setup prox to handle blog requests
  httpProxy.createServer({
      hostnameOnly: true,
      router: {
          'http://localhost': '8080',
          'http://localhost/blog': '2368' 
      }
  }).listen(8000);
  </code></pre>
  
  <p>Previously I was using this:</p>
  
  <pre><code>http.createServer(app).listen(app.get('port'), function(){
      console.log("Express server listening on port " + app.get('port'));
  });
  </code></pre>
  
  <p>Basically, I want to still use express... but, when people go to <code>http://localhost/blog</code> get taken to the blog but still be served over <code>port 8080</code> (which will eventually be port 80)</p>
  
  <p>So I switched it to this and it worked better. The problem is that express takes over the routing (from what I can tell)</p>
  
  <pre><code>var options = {
      // pathnameOnly: true,
      router: {
          'localhost': 'localhost:8080',
          'localhost/blog': 'localhost:2368'
      }
  }
  
  // Setup prox to handle blog requests
  var proxyServer = httpProxy.createServer(options);
  proxyServer.listen(9000);
  
  require('./app/server/router')(app);
  
  http.createServer(app).listen(app.get('port'), function(){
      console.log("Express server listening on port " + app.get('port'));
  });
  </code></pre>