title: Diagnosing a HTTP 500 Error With Apache and HAProxy
body: <p>I'm running into an issue with an application I'm working on that has me completely stumped. The program is an iOS app that needs to be able to asynchronously download images from an SVN server. Users have been reporting missing images and when I dug into the code, I noticed that some of the downloads were timing out. I tried increasing the timeout on the request and adding code to retry on failure with no success.</p>
  
  <p>Looking at the apache access logs for the web server, I noticed that some of the download requests were failing with '500' errors. The problem is, I don't actually see any details logged for those errors in the top level apache error logs or in the apache error logs for that site. Most of the information I can find is for people having issues with php, but I already eliminated that as a possibility. The error logging for php is enabled and I'm not seeing anything in those logs.</p>
  
  <p>My other thought was that it might be an issue with the proxy server (haproxy) that is directing the requests to my web server, but that also seems to be working correctly. If I look at the line in the haproxy log for the failing request, it is showing status '200'.</p>
  
  <p>Can anyone shed some light on this? The missing images are a major issue for my users and I don't know what else to look at.</p>
  
  <p><strong>Update:</strong>
  I think I can rule out the proxy server as a cause. I modified the code to point directly at the svn server via the ip address and the results were the same.</p>
  
  <p><strong>apache access log</strong></p>
  
  <pre><code>"GET /svn/mysite/33245/img/13301.jpg HTTP/1.1" 500 500 1 251118 "-" "MyApp/1.1.57 CFNetwork/758.5.3 Darwin/15.6.0"
  </code></pre>
  
  <p><strong>haproxy log:</strong> </p>
  
  <pre><code>http-in backend_www_static/web01 21/0/1/3/1746 200 96024 - - CD-- 3/3/1/1/0 0/0 "GET /svn/mysite/33245/img/13301.jpg HTTP/1.1"
  </code></pre>