ūüõ† Fix net::ERR_CONNECTION_CLOSED error for¬†requests with large headers

By default, the Nginx server with enabled HTTP/2 protocol has 4KB limit per request header field. If you’ll try to send a request with a larger header, you can get net::ERR_CONNECTION_CLOSED or net::ERR_HTTP2_PROTOCOL_ERROR:

To fix this issue, update your configuration by adding the following params to your server section:

server {
  ...
  large_client_header_buffers 8 16k; # default 4 4k
  http2_max_field_size 16k; # default 4k
  ...
}
ūüí° Depending on your Nginx server version, required changes in¬†config params can be different. Learn more on the¬†official Nginx docs page: http://nginx.org/en/docs/http/ngx_http_v2_module.html
¬†800¬†  2021   http2   nginx
1 comment
Renat 2022

Don’t hesitate to leave your comment below if this article was helpful for you, or if you want to share some feedback