Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

making http2 ajax call from angular/javascript application

I'm trying to make http2 implementation of my service. I used Jetty 9 with ALPN jar and I made the code as per the documentations. The server got started and I can access the url http://localhost:8443/myurl from chrome version 51. I'm using a chrome extension HTTP2/ SPDY Indicator to see the HTTP2 request and it indicate the request is http2. When I tried to make call a service using Ajax through angularjs I can't see the extension report that HTTP2 call is made.

Is it the problem with the extension to unable to detect Ajax call. Or do I manually need to set any HTTP2 specific headers for http2 call to get activated.

Any help appreciated.

Thanks in advance.

like image 430
Sheeja C Avatar asked Mar 07 '26 11:03

Sheeja C


1 Answers

The Chrome HTTP/2 Indicator extension reports whether the top level document has been downloaded using HTTP/2.

XHR calls are not reported by that extension.

If you browse chrome://net-internals/#http2 in your Chrome browser, you will see the HTTP/2 connections that are alive, and click on the one for your domain will give additional information, included XHR calls.

Alternatively, you can enable the server-side DEBUG logging for HTTP/2 by enabling the org.eclipse.jetty.http2 category to DEBUG, and you will see the XHR calls arriving to the server.

You don't need to do anything special or add any HTTP/2 headers on your XHR calls (or those that Angular makes for you): the browser knows if it can use HTTP/2, and if it can it will use it.

like image 78
sbordet Avatar answered Mar 09 '26 00:03

sbordet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!