title: Who causes this "502 Bad Gateway nginx"?
body: <p>I recently started using SendPulse.com for sending email campaigns to a list of thousands of recipients. </p>
  
  <p>Sometimes my email campaigns have contained links, such as to a post on Facebook. </p>
  
  <p>SendPulse is supposed to track which recipients click which links. </p>
  
  <p>To do this, before sending out my email campaign, they replace the URLs in the message with URLs that go to their systems, which can record the tracking and then redirect the visitors to the real destination.</p>
  
  <p>Unfortunately, these redirect links often do not work. We've frequently been seeing this error <code>502 Bad Gateway nginx/1.10.3 (Ubuntu)</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/TMKo3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TMKo3.png" alt="502 Bad Gateway nginx/1.10.3 (Ubuntu)"></a></p>
  
  <p>Here is the HTML of that page:</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.10.3 (Ubuntu)&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;!-- a padding to disable MSIE and Chrome friendly error page --&gt;
  </code></pre>
  
  <p>It occurs to me that the root cause of the problem could be within SendPulse, CloudFlare (which we use for DNS), or Facebook. </p>
  
  <p>We know it's not browser-specific, and we know that visitors from different parts of the world have experienced this problem.</p>
  
  <p>It seems highly unlikely that CloudFlare¹ or Facebook would frequently throw this error. </p>
  
  <p><strong>Are there certain commands (maybe related to <code>traceroute</code>?) that could identify who is throwing the error (SendPulse, CloudFlare, Facebook, or someone else)?</strong></p>
  
  <p>¹<sub>By the way, <a href="https://support.cloudflare.com/hc/en-us/articles/115003011431#h_85e06a1a-fa89-4685-aa24-2aaf57c0141b" rel="nofollow noreferrer">CloudFlare docs</a> say: "If the error does not mention “cloudflare,” contact your hosting provider for assistance on 502/504 errors from your origin." But in CloudFlare, my subdomain is set to "DNS only" (gray cloud) instead of "Proxied" (orange cloud). I don't know whether these docs apply to a subdomain set to "DNS only".</sub></p>