title: Heroku truncates HTTP responses?
body: <p>I am running a <strong>Flask/Gunicorn</strong> Python app on a Heroku Cedar dyno. The app returns <code>JSON responses</code> to its clients (it's an <code>API server</code>, really).</p>
  
  <p>Once in a while clients get 0-byte responses. It's not me returning them, however. Here is a snippet of my app's log:</p>
  
  <blockquote>
    <p>Mar 14 13:13:31 d.0b1adf0a-0597-4f5c-8901-dfe7cda9bce0 app[web.1]
    [2013-03-14 13:13:31 UTC] 10.104.41.136 apisrv -
    api_get_credits_balance(): session_token=[MASKED]</p>
  </blockquote>
  
  <p>The first line above is me starting to handle the request. </p>
  
  <blockquote>
    <p>Mar 14 13:13:31 d.0b1adf0a-0597-4f5c-8901-dfe7cda9bce0 app[web.1]
    [2013-03-14 13:13:31 UTC] 10.104.41.136 apisrv 1252148511
    api_get_credits_balance(): returning [{'credits_balance': 0}]</p>
  </blockquote>
  
  <p>The second line is me returning a value (to Flask -- it's a Flask "Response" object).</p>
  
  <blockquote>
    <p>Mar 14 13:13:31 d.0b1adf0a-0597-4f5c-8901-dfe7cda9bce0 app[web.1]
    "10.104.41.136 - - [14/Mar/2013:13:13:31] "POST
    /get_credits_balance?session_token=MASKED HTTP/1.1" 200 22 "-"
    "Appcelerator Titanium/3.0.0.GA (iPhone/6.1.2; iPhone OS; en_US;)"</p>
  </blockquote>
  
  <p>The third line is Gnicorn's, where you can see the Gunicorn got the 200 status and 22 bytes HTTP body ("<code>200 22</code>").</p>
  
  <p>However, the client got 0 bytes. Here is the Heroku router log:</p>
  
  <blockquote>
    <p>Mar 14 13:13:30 d.0b1adf0a-0597-4f5c-8901-dfe7cda9bce0 heroku[router]
    at=info method=POST path=/get_credits_balance?session_token=MASKED
    host=matchspot-apisrv.herokuapp.com fwd="66.87.116.128" dyno=web.1
    queue=0 wait=0ms connect=1ms service=19ms status=200 bytes=0</p>
  </blockquote>
  
  <p>Why does Gunicorn return 22 bytes, but Heroku sees 0, and indeed passes back 0 bytes to the client? Is this a Heroku bug?</p>