title: Mac OSX Server : 502 Proxy Error : The proxy server received an invalid response from an upstream server
body: <p>I have a Mac OS X Server with a PHP script that send images on a Amazon S3 (using the Amazon PHP SDK).</p>
  
  <p>Sometimes, the images can be heavy, and the upload on Amazon S3 takes time, and after approximately 60 secondes, I have this error :</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;502 Proxy Error&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Proxy Error&lt;/h1&gt;
          &lt;p&gt;The proxy server received an invalid
  response from an upstream server.
              &lt;br /&gt;
  The proxy server could not handle the request 
              &lt;em&gt;
                  &lt;a href="/insert.php"&gt;POST&amp;nbsp;/insert.php&lt;/a&gt;
              &lt;/em&gt;.
              &lt;p&gt;
  Reason: 
                  &lt;strong&gt;Error reading from remote server&lt;/strong&gt;
              &lt;/p&gt;
          &lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am on Mac OSX 10.11.5 (El Capitan), and my Server tools are on version 5.1.5.</p>
  
  <p>Do you have a solution to fix this error please ?</p>