Fetch and Axios make an HTTP/1.1 request first before upgrading to HTTP/2 in react-native. Is there a way to directly connect using HTTP/2?

#1

I have a HTTP/2 server running in AWS. When I use my react native iOS app to connect to the server to fetch data using Axios or Fetch, the first request made by the the client is a HTTP/1.1 to which the server responds with [H2] upgrade response. From then on, the client makes HTTP/2 requests.

I want to avoid the first HTTP/1.1 request. Is there a way to do that ?

0 Likes

#2

Hi @frontm,

Do sections 3.2, 3.2.1, and 3.3 of the following document provide you with what you need to know? https://http2.github.io/http2-spec/#starting

e.g. From section 3.2: “If concurrency of an initial request with subsequent requests is important, an OPTIONS request can be used to perform the upgrade to HTTP/2, at the cost of an additional round trip.”

0 Likes

#3

Hi @schazers, we have decided to move away from expo. We need to have full control over the network traffic in our application.
Thanks anyway for your help

0 Likes

closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

0 Likes