<p>I know this is somewhat specific of a question, but I'm having a problem I can't seem to track down. I have a single pod deployed to EKS - the pod contains a python app, and a varnish reverse caching proxy. I'm serving chunked json (that is, streaming lines of json, a la <a href="http://jsonlines.org/" rel="nofollow noreferrer">http://jsonlines.org/</a>), and it can be multiple GB of data.</p>

<p>The first time I make a request, and it hits the python server, everything acts correctly. It takes (much) longer than the cached version, but the entire set of json lines is downloaded. However, now that it's cached in varnish, if I use curl, I get:</p>

<pre><code>curl: (56) GnuTLS recv error (-110): The TLS connection was non-properly terminated.
</code></pre>

<p>or</p>

<pre><code>curl: (56) GnuTLS recv error (-9): A TLS packet with unexpected length was received.
</code></pre>

<p>The SSL is terminated at the ELB, and when I use curl from the proxy container itself (using <code>curl http://localhost?....</code>), there is no problem.</p>

<p>The hard part of this is that the problem is somewhat intermittent.</p>

<p>If there is any advice in terms of clever <code>varnishlog</code> usage, or anything of the same ilk on AWS, I'd be much obliged.</p>

<p>Thanks!</p>

Hoopes
<p>Because <em>TLS</em> is terminated on your <em>ELB</em> loadbalancers, the connection between should be in plain HTTP.</p>

<p>The error is probably not coming from Varnish, because Varnish currently doesn't handle TLS  natively. I'm not sure if <code>varnishlog</code> can give you better insights in what is actually happening.</p>

<h2>Checklist</h2>

<p>The only checklist I can give you is the following:</p>

<ul>
<li>Make sure the certificate you're using is valid</li>
<li>Make sure you're connecting to your target group over HTTP, not HTTPS</li>
<li>If you enable the PROXY protocol on your ELB, make sure Varnish has a <code>-a</code> listener that listens for <code>PROXY</code> protocol requests, on top of regular HTTP requests.</li>
</ul>

<h2>Debugging</h2>

<p>Perform top-down debugging:</p>

<ul>
<li>Increase the verbosity of your <em>cURL</em> calls and try to get more information about the error</li>
<li>Try accessing the logs of your <em>ELB</em> and get more details there</li>
<li>Get more information from your <em>EKS</em> logs</li>
<li>And finally, perform a <code>varnislog -g request -q "ReqUrl eq '/your-url'"</code> to get a full Varnishlog for a specific URL</li>
</ul>
