启用http2
模块,执行如下命令:
java -jar $JETTY_HOME/start.jar --add-modules=http2
命令的输出,如下:
INFO : http2 initialized in ${jetty.base}/start.d/http2.ini
INFO : Base directory was modified
http2
模块的配置文件$JETTY_BASE/start.d/http2.ini
,内容如下:
# ---------------------------------------
# Module: http2
# Enables the support for the secure HTTP/2 protocol.
# ---------------------------------------
--modules=http2
## Specifies the maximum number of concurrent requests per session.
# jetty.http2.maxConcurrentStreams=128
## Specifies the initial stream receive window (client to server) in bytes.
# jetty.http2.initialStreamRecvWindow=524288
## Specifies the initial session receive window (client to server) in bytes.
# jetty.http2.initialSessionRecvWindow=1048576
## Specifies the maximum number of keys in all SETTINGS frames received by a session.
# jetty.http2.maxSettingsKeys=64
## Specifies the maximum number of bad frames and pings per second,
## after which a session is closed to avoid denial of service attacks.
# jetty.http2.rateControl.maxEventsPerSecond=50
各参数的说明,如下:
jetty.http2.maxConcurrentStreams
单个会话中允许并行的HTTP请求数量的上限值,默认值为128
。jetty.http2.initialStreamRecvWindow
流接收数据的窗口的初始容量,单位:字节,默认值为524288
。jetty.http2.initialSessionRecvWindow
会话接收数据的窗口的初始容量,单位:字节,默认值为1232896
。jetty.http2.maxSettingsKeys
在会话的SETTINGS
帧中允许接收的key
的数量,默认值为64
。jetty.http2.rateControl.maxEventsPerSecond
每秒允许出现的坏帧及ping
的数量的上限,超出上限,则判定会话失效,以此来规避潜在的DoS攻击。
默认值为50
。
HTTP2要求使用安全通道传输数据,http2c模块基于非安全通道提供HTTP2协议的服务。
启用http2c
模块,执行如下命令:
java -jar $JETTY_HOME/start.jar --add-modules=http2c
命令的输出,如下:
INFO : http2c initialized in ${jetty.base}/start.d/http2c.ini
INFO : Base directory was modified
http2c
模块的配置文件$JETTY_BASE/start.d/http2c.ini
,内容如下:
# ---------------------------------------
# Module: http2c
# Enables the support for the clear-text HTTP/2 protocol.
# ---------------------------------------
--modules=http2c
## Specifies the maximum number of concurrent requests per session.
# jetty.http2c.maxConcurrentStreams=128
## Specifies the initial stream receive window (client to server) in bytes.
# jetty.http2c.initialStreamRecvWindow=524288
## Specifies the initial session receive window (client to server) in bytes.
# jetty.http2c.initialSessionRecvWindow=1232896
## Specifies the maximum number of keys in all SETTINGS frames received by a session.
# jetty.http2c.maxSettingsKeys=64
## Specifies the maximum number of bad frames and pings per second,
## after which a session is closed to avoid denial of service attacks.
# jetty.http2c.rateControl.maxEventsPerSecond=50
各参数的说明,如下:
jetty.http2c.maxConcurrentStreams
单个会话中允许并行的HTTP请求数量的上限值,默认值为128
。jetty.http2c.initialStreamRecvWindow
流接收数据的窗口的初始容量,单位:字节,默认值为524288
。jetty.http2c.initialSessionRecvWindow
会话接收数据的窗口的初始容量,单位:字节,默认值为1232896
。jetty.http2c.maxSettingsKeys
在会话的SETTINGS
帧中允许接收的key
的数量,默认值为64
。jetty.http2c.rateControl.maxEventsPerSecond
每秒允许出现的坏帧及ping
的数量的上限,超出上限,则判定会话失效,以此来规避潜在的DoS攻击。
默认值为50
。