How to know if the client is using http or http2?
See original GitHub issueI see in the nginx example that it can listen for both http and http2 calls, given two different ports:
server {
listen 9091;
listen 9092 http2;
server_name localhost;
location / {
grpc_pass localhost:9090;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Transfer-Encoding,Custom-Header-1,X-Accept-Content-Transfer-Encoding,X-Accept-Response-Streaming';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Transfer-Encoding,Custom-Header-1,X-Accept-Content-Transfer-Encoding,X-Accept-Response-Streaming';
add_header 'Access-Control-Expose-Headers' 'Content-Transfer-Encoding';
}
}
}
Does it mean that the JS grpc-web client knows how to upgrade to http2 if the given port is http2? If the given port when creating the client is the http one, how the grpc-web client can support the streaming features (server push for example)?
I’m not clear on this point,
thank you for your help!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
HTTP/2 Test - Verify HTTP/2 Support - KeyCDN Tools
This test can check HTTP and HTTPS but most browsers only support HTTP/2 for HTTPS, which means you must migrate to HTTPS if...
Read more >How to Confirm HTTP/2 Works on Your Site - ServerPilot
Google Chrome offers a quick and easy way to check if HTTP/2 is supported on your SSL-enabled site. First, visit your site in...
Read more >Check if HTTP/2 is enabled - Geekflare Tools
Check if the site is taking advantages of the latest HTTP 2 protocol for better content delivery.
Read more >How to test if your website supports HTTP/2.0 - Edit Agency
To do this, open the Developer toolkit by hitting F12 or right clicking and inspect element in Chrome. Then navigate to the Network...
Read more >Tools for debugging, testing and using HTTP/2
If you need to test a number of web sites to see which support HTTP/2 there's a tool called h2scan. Feed it a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Like this ?
May I ask why grpc-web is not using “modified grpc over HTTP2” when all browsers support h2?
Finally, if it’s not using h2, I’m curious to know how the server push is implemented over http1.1 (long polling?)
Many thanks
Got it! Many tanks