title: Node.js proxy requests working to app server but failing to local host
body: <p>I've inherited a project that involves a administrator app running on node.js talking to a REST-like api that runs on apache. I'm very familiar with [LM]AMP but a total newbie to node.js. </p>
  
  <p>I'm trying to setup the whole envionment on my local machine, which is MAMP.</p>
  
  <p>When I use the original settings (in a node config file under a directory called 'build'), where the app host points to the real server, the node.js site functions correctly:</p>
  
  <pre><code>var options = underscore.defaults(options, {
      ...
      port: 8000,
      proxy_app: true,
      app_host: 'www.example.com',
      app_port: 80
  });
  </code></pre>
  
  <p>In a browser, going to <code>http://localhost:8000/app/do/something</code> returns some valid json.</p>
  
  <p>(my understanding here is limited, but I believe node is proxying this request over to the apache server on which the app is running).</p>
  
  <p>However, when I point it to my local server...</p>
  
  <pre><code>var options = underscore.defaults(options, {
      ...
      port: 8000,
      proxy_app: true,
      app_host: 'www.mylocalexample.com',
      app_port: 80
  });
  </code></pre>
  
  <p>Now, going to <code>http://localhost:8000/app/do/something</code> returns a 404 Not Found.</p>
  
  <p>So the only difference in this node.js config file is the host, which is valid (if I call the app api directly on my localhost it works, ie I get back valid json). For some reason the request proxied by node.js doesn't seem to get sent to my MAMP server, or does get sent but MAMP is rejecting it. There are no errors in the apache log.</p>
  
  <p>Any ideas? Firebug is also not telling me much of use, so I'm not sure how to debug this further. My instinct says it must be some setting on my MAMP's Apache but I'm not sure what it could be.</p>