title: upstream prematurely closed connection while reading response header from upstream - Jetty
body: <p>I am using Spring boot application with embedded Jetty.</p>
  <blockquote>
  <p>Spring boot version - 2.2.1.RELEASE
  Jetty Version - 9.4.25.v20191220</p>
  </blockquote>
  <p>Applications are running on multiple hosts(Say 5 hosts) and with a load balancer in front of it.</p>
  <p><strong>Load balancer setting:-</strong></p>
  <pre><code>Keep Alive conections - 20
  Keepalive Timeout - 60s
  </code></pre>
  <p><strong>Jetty Settings</strong></p>
  <pre><code>  server.jetty.connection-idle-timeout=62000  (62 Secs)
  </code></pre>
  <p>Load balancer is throwing 502 sometime with the logs below.</p>
  <pre><code>upstream prematurely closed connection while reading response header from upstream, client: ******, server: xyz.test.com, request: &quot;GET /health/check HTTP/1.1&quot;, upstream: &quot;https://XXXXX:8443/health/check&quot;, host: &quot;xyz.test.com&quot; 
  
  upstream prematurely closed connection while reading response header from upstream, client: ******, server: xyz.test.com, request: &quot;GET /api/v1/weather/2485 HTTP/1.1&quot;, upstream: &quot;https://XXXXXX:8443/api/v1/weather/2485&quot;, host: &quot;xyz.test.com&quot; 
  </code></pre>
  <p>We are using all default setting for Spring boot embedded Jetty. Is there anything config to be changed?</p>
  <p>We have not enabled access log on the server side and no logs related to 502 in our logs.</p>