http/2 using uvicorn #2323
-
Can someone explain this? When API's are inspected on Chrome developer tools, it show protocol as h2. I wonder how's is it possible , when Uvicorn documentation states that it supports Http1.1? In the same application , we replaced Uvicorn with Hyercorn and deployed in the sandbox and it behaved and worked fine. On checking the ingress ALB console, Load balancer attributes , Http/2 was already enabled. I am confused if there is any merit to using Hyercorn over Uvicorn or stick to uvicorn ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
When using load balancers and/or reverse proxies you have two connections happening: the downstream and the upstream. Thus, with uvicorn the proxy will use HTTP/1.1, with Hypercorn or servers supporting HTTP/2 it might use that version to talk to the upstream (if instructed to do so). |
Beta Was this translation helpful? Give feedback.
When using load balancers and/or reverse proxies you have two connections happening: the downstream and the upstream.
The browser connects to the balancer/proxy (downstream) using the available protocol (both ALB and nginx support HTTP/2), then the balancer/proxy talks to your application (upstream) using a separated HTTP connection.
Thus, with uvicorn the proxy will use HTTP/1.1, with Hypercorn or servers supporting HTTP/2 it might use that version to talk to the upstream (if instructed to do so).