title: React Native Image requests over a single HTTP/2 connection
body: <p>We have many React Native <a href="https://facebook.github.io/react-native/docs/image" rel="nofollow noreferrer"><code>&lt;Image&gt;</code></a> components rendering per screen and are witnessing performance issues <a href="https://stackoverflow.com/a/15089409/1337422">due to many simultaneous http requests</a>. Opening and closing a connection is expensive, and having too many simultaneous connections can hit limitations that cause timeouts.</p>
  <p><a href="https://stackoverflow.com/questions/36517829/what-does-multiplexing-mean-in-http-2">HTTP/2 features multiplexing</a>, allowing multiple requests and response messages between the client and server to be in flight at the same time over a single connection, instead of multiple connections, which improves page load times.</p>
  <p><a href="https://aws.amazon.com/about-aws/whats-new/2016/09/amazon-cloudfront-now-supports-http2/" rel="nofollow noreferrer">CloudFront supports HTTP/2, HTTP/1.1, and HTTP/1 by default depending on the version the client sends up in the request header.</a></p>
  <p>We noticed that our React Native app is sending HTTP/1.1 as the version in the request headers for any GET on an <code>&lt;Image&gt;</code>. Unlike popular apps, we're opening and closing a single connection for each GET. <strong>How do we make sure React Native Image requests use HTTP/2 and share a connection?</strong></p>
  <p><em>(Our images all share the same CloudFront domain.)</em></p>
  <p><a href="https://i.stack.imgur.com/qIGc1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qIGc1.png" alt="enter image description here" /></a></p>
  <hr />
  <p><strong>Edit - More Information:</strong></p>
  <p>Our CloudFront distribution supports HTTP/2:</p>
  <p><a href="https://i.stack.imgur.com/e1uxQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e1uxQ.png" alt="enter image description here" /></a></p>
  <p>And it appears the client and server are agreeing on h2:</p>
  <p><a href="https://i.stack.imgur.com/cxUwS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxUwS.png" alt="enter image description here" /></a></p>