title: http request from nodejs to django
body: <p>We have a django app and I need to add some functionality with NodeJS. I've been following this example: 
  <a href="http://www.maxburstein.com/blog/realtime-django-using-nodejs-and-socketio/" rel="nofollow">http://www.maxburstein.com/blog/realtime-django-using-nodejs-and-socketio/</a>
  using socket.io and it works perfect on localhost. Now, the problem comes when moving the application to apache server. I need to send a POST request to django and all I get is a timeout response. </p>
  
  <p>Our django app over apache is listening on port 80 and node is listening on port 4000. The config for the http request is as follows:</p>
  
  <pre><code>var options = {
          hostname: 'hostaddress',
          port: '80',
          path: '/dashboards/datosinforme/',
          method: 'POST',
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded',
              'Content-Length': values.length
          }
      };
      var req = http.request(options, function(res){
          res.setEncoding('utf8');
          var data_obj = "";
          res.on('data',function(data){
              data_obj+=data;
          });
          res.on('end', function(){
              ...some functionality...
          });
      });
      req.write(values);
      req.end();
  </code></pre>
  
  <p>I've tried both local and public IPs. I get no response from django using the public IP and Bad Request using the local IP. </p>
  
  <p>I'd be eternally grateful if anyone could help. Thanks in advance.</p>
  
  <p>Edit: Ok, I now tried with 127.0.0.1 as hostname (because both node and django are on the same machine) and I get a Bad Request response, but I don't really see anything wrong in it:</p>
  
  <pre><code>POST /dashboards/datosinforme HTTP/1.1
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 174
  Host: 127.0.0.1:80
  Connection: keep-alive
  
  id=5&amp;tipo_de_fecha=d&amp;time_zone=Europe%2FBerlin
  </code></pre>