How to disable HTTP/2 in chrome or chromium?
Asked Answered
S

4

34

I'm trying to debug difference between HTTP/1.1 and HTTP/2. Is there any possibility for disabling HTTP/2 in chrome or chromium? I couldn't find this option flag in chrome 56. I have tried chromium 58 with flag --disable-http2:

./Chromium.app/Contents/MacOS/Chromium --disable-http2

But content is still delivered with HTTP/2 protocol after using this flag:

Chromium --disable-http2

Spaceport answered 24/2, 2017 at 10:5 Comment(1)
Have you killed all the sessions before you run it with this flag? What is the CLI output when you actually run thisEla
E
28

For what it is worth, the flag works.

The issue is that you need to quit EVERYTHING Chrome for it to take effect. Including plugin shims and other chrome tabs and so on.

It is not enough just to add the command line switch.

Eustace answered 22/3, 2017 at 14:44 Comment(5)
Flag in Chromium didn't work since I had running instance of Chrome. Closing Chrome and rerun Chromium with flag fixed the issue.Spaceport
It also works if you specify a different --user-profile-dir .Ethnomusicology
Not just plugin shims and tabs, also chrome apps!Centrosome
Is your answer only for disable-http2 or for all flags?Spaceport
some flags, I am not sure if all flags require this, you will need to test on a case by case basis.Eustace
C
4

An easier way to achieve something broadly equivalent is to use an HTTP Proxy, like https://www.telerik.com/fiddler. This adds negligible additional time to your requests, and (as far as I know) doesn't support http/2 at all (yet); even if it did, I'm pretty sure it would be much easier/practical to switch behavior in than restarting all your Chrome windows.

The advantage of this approach is that it takes effect immediately - disabling and reenabling HTTP/2 becomes as easy as starting and stopping the proxy, without messing with the (if you're anything like me) dozens of Chrome tabs you have open, to StackOverflow and elsewhere :)

Climb answered 14/2, 2019 at 9:53 Comment(0)
A
3

What happens when you try doing the same thing in WebPageTest (select Chrome as the test agent and add the command line switch in the Chrome tab under advanced settings)

Here's a test I did for my personal site just now and the flag appears to work OK (if you look at the response headers you'll see HTTP/1.1)

https://www.webpagetest.org/result/170322_1B_ab8656afcfb8bcc4103e9872ff56c28b/1/details/#waterfall_view_step1

Argali answered 22/3, 2017 at 14:43 Comment(0)
A
0

I have seen the same problem created by a firewall running in proxy mode vs flow mode.
The firewall would buffer the entire file so it could scan it then pass it along vs scanning the individual packets.

https://docs.fortinet.com/document/fortigate/6.4.4/administration-guide/721410/inspection-modes

The problem would only happen when using http2 and might have something to do with http request priority not being handled properly or it forced it single threaded.

We would have a video request start with a low priority that would stall then start causing other file downloads to be delayed. Then there was a api poler in the background coming in with high priority requests. After a few high priority requests were blocked chrome would cancel the low priority video.

It would happen in other cases but the video made it very reproduceable for us.

https://medium.com/dev-channel/javascript-loading-priorities-in-chrome-57c54cfa6672 https://blog.cloudflare.com/better-http-2-prioritization-for-a-faster-web/ https://blog.cloudflare.com/http-2-prioritization-with-nginx/ https://calendar.perfplanet.com/2018/http2-prioritization/

We set it back to flow mode on the firewall and the problem went away. Afterwards the downloads all happened in parallel with no blocking or stalling in the chrome network waterfall.

Arcuation answered 25/2, 2022 at 23:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.