I have tested a few browsers (namely firefox, edge, chrome and chromium, in their mobile and desktop versions) and found that each of them sent the following accept-encoding
header value: gzip, deflate, br
when performing a request.
According to the doc, this header field consists of a list of encodings supported by the browser, in order of preference. What surprises me is that brotli (br
) is listed last, which means that it is less likely to be the selected algorithm for content-encoding than gzip
even though it should achieve a better compression ratio.
Is there a specific reason as to why browser tends to prefer gzip over brotli ?
I am not seeing anywhere in the specifications that the ordering has any meaning. To the contrary, I see that a preference can only be expressed by providing quality weights for the encoding, and that providing such preferences from the client side is discouraged. It is up to the server to pick among the choices that the client can accept, however it likes.