gzip_http_version 1.1; in Nginx, when using HTTP/2

In an Nginx server block of a site aimed to work with HTTP/2, I've seen this:

gzip_http_version 1.1;

Can this make some conflict with some packets sent in HTTP/2?

I don't understand this Gzip directive hence I can't say if HTTP/2 packets could be affected by it.


gzip_http_version is the minimum version of the HTTP protocol of the request (coming from client) needed to compress the response from server. It defaults to 1.1.

So, any user agent that is sending request using protocol version 1.0, won't get the response compressed from server; the response would go as-is. Note that, setting the value to 1.1 would probably hurt very very tiny subset of crowd (probably someone with Win XP, which is unsupported now BTW), if any.

To answer your question:

Can this make some conflict with some packets sent in HTTP/2?

No, as nginx would handle requests differently based on the value of $server_protocol variable (one of HTTP/1.0, HTTP/1.1, HTTP/2.0).


As a side note, as Transfer-Encoding header is not supported in HTTP/1.0 you should not set gzip_http_version to 1.0. Otherwise, you would not get keepalives as Content-Length header is not set when gzip_http_version is used; HTTP/1.1 tackles this using Transfer-Encoding: chunked header.