= cowboy_http2(3) == Name cowboy_http2 - HTTP/2 == Description The module `cowboy_http2` implements HTTP/2 as a Ranch protocol. == Options // @todo Might be worth moving cowboy_clear/tls/stream_h options // to their respective manual, when they are added. [source,erlang] ---- opts() :: #{ connection_type => worker | supervisor, enable_connect_protocol => boolean(), env => cowboy_middleware:env(), inactivity_timeout => timeout(), initial_connection_window_size => 65535..16#7fffffff, initial_stream_window_size => 0..16#7fffffff, max_concurrent_streams => non_neg_integer() | infinity, max_decode_table_size => non_neg_integer(), max_encode_table_size => non_neg_integer(), middlewares => [module()], preface_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } ---- Configuration for the HTTP/2 protocol. This configuration is passed to Cowboy when starting listeners using `cowboy:start_clear/3` or `cowboy:start_tls/3` functions. It can be updated without restarting listeners using the Ranch functions `ranch:get_protocol_options/1` and `ranch:set_protocol_options/2`. The default value is given next to the option name: connection_type (supervisor):: Whether the connection process also acts as a supervisor. enable_connect_protocol (false):: Whether to enable the extended CONNECT method to allow protocols like Websocket to be used over an HTTP/2 stream. This option is experimental and disabled by default. env (#{}):: Middleware environment. inactivity_timeout (300000):: Time in ms with nothing received at all before Cowboy closes the connection. initial_connection_window_size (65535):: Initial window size for the connection. This is the total amount of data (from request bodies for example) that may be buffered by the connection across all streams before the user code explicitly requests it. + Note that this value cannot be lower than the default. initial_stream_window_size (65535):: Initial window size for new streams. This is the total amount of data (from request bodies for example) that may be buffered by a single stream before the user code explicitly requests it. max_concurrent_streams (infinity):: Maximum number of concurrent streams allowed on the connection. max_decode_table_size (4096):: Maximum header table size used by the decoder. This is the value advertised to the client. The client can then choose a header table size equal or lower to the advertised value. max_encode_table_size (4096):: Maximum header table size used by the encoder. The server will compare this value to what the client advertises and choose the smallest one as the encoder's header table size. middlewares ([cowboy_router, cowboy_handler]):: Middlewares to run for every request. preface_timeout (5000):: Time in ms Cowboy is willing to wait for the connection preface. shutdown_timeout (5000):: Time in ms Cowboy will wait for child processes to shut down before killing them. stream_handlers ([cowboy_stream_h]):: Ordered list of stream handlers that will handle all stream events. == Changelog * *2.4*: Add the options `initial_connection_window_size`, `initial_stream_window_size`, `max_concurrent_streams`, `max_decode_table_size` and `max_encode_table_size` to configure HTTP/2 SETTINGS. * *2.4*: Add the experimental option `enable_connect_protocol`. * *2.0*: Protocol introduced. == See also link:man:cowboy(7)[cowboy(7)], link:man:cowboy_http(3)[cowboy_http(3)], link:man:cowboy_websocket(3)[cowboy_websocket(3)]