title: mod_proxy 502 Proxy Error when upload a file
body: <p>I'm trying to configure the following environment: a VPS running apache and mod_proxy to proxy another server running at home (the backend). I'm able to download files but when I try to upload files the POST request fails with this error:</p>
  
  <pre><code>Proxy Error
  
  The proxy server received an invalid response from an upstream server.
  The proxy server could not handle the request POST /upload/upload.php.
  
  Reason: Error reading from remote server
  </code></pre>
  
  <p>What I don't understand is why it works for files as low as 500 bytes. And it does quickly! However, when I try to upload a tiny 4kb file, it takes forever until the error is reached. As expected, the upload works flawlessly when the backend is accessed directly, without the VPS. I tried many configurations for both sides, also tried to increase the timeout but I don't think this is the way to go. The backend has mod_access installed and it doesn't log anything when the file upload fails.</p>
  
  <p>The apache logs the following:</p>
  
  <pre><code>[Thu Nov 07 22:26:03.044309 2013] [proxy_http:error] [pid 9173] (70007)The timeout specified has expired: [client 177.148.252.99:54097] AH01102: error reading status line from remote server myhome.com, referer: http://frontend.com/upload/
  [Thu Nov 07 22:26:03.044423 2013] [proxy:error] [pid 9173] [client 177.148.252.99:54097] AH00898: Error reading from remote server returned by /upload/upload.php, referer: http://frontend.com/upload/
  </code></pre>
  
  <p>The VPS is running Apache 2.4.6 and the server running at home is a Lighttpd 1.4.32 with SSL. </p>
  
  <p>The virtual host redirecting to the backend is configured as follows:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
          ServerAdmin webmaster@frontend.com
          ServerName frontend.com
          ProxyPass        / http://backend.com/
          ProxyPassReverse / http://backend.com/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Front-end:
  <a href="http://frontend.com/upload/" rel="nofollow">http://frontend.com/upload/</a></p>
  
  <p>Back-end:
  <a href="http://backend.com/upload/" rel="nofollow">http://backend.com/upload/</a></p>
  
  <p>Do you have any ideas?</p>