title: Paypal IPN sandbox returning 502 bad gateway error in Nodejs
body: <p>I'm implementing Paypal IPN in NodeJS with express but I am getting this error message from Paypal Sandbox:</p>
  
  <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;502 Bad Gateway&lt;/title&gt;&lt;/head&gt; &lt;body bgcolor="white"&gt; &lt;center&gt;&lt;h1&gt;502 Bad Gateway&lt;/h1&gt;&lt;/center&gt; &lt;hr&gt;&lt;center&gt;nginx/1.6.0&lt;/center&gt; &lt;/body&gt; &lt;/html&gt; 
  </code></pre>
  
  <p>I used the paypal-ipn dependency and below is my code:</p>
  
  <pre><code>.post('/paypal_ipn', function(req, res) {
      var params = req.body;
      var ip = req.ip;
      console.log(params);
  
      res.status(200);
      ipn.verify(params, {'allow_sandbox': true}, function callback(err, mes) {
          if (err) {
              console.error(err);
          } else {
              // Do stuff with original params here
              if (params.payment_status === 'Completed') {
                // Payment has been confirmed as completed
              }
          }
      });
  </code></pre>
  
  <p>})</p>
  
  <p>I tried configuring http and https on port 3000 but got the same error message. </p>
  
  <p>Any ideas on this?</p>