Version: 9.4.32.v20200930 |

Configuring HTTP/2
Previous | Chapter 16. HTTP/2 Home | Next

##### Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

## Configuring HTTP/2

Enabling the HTTP/2 module in the Jetty server does not create a HTTP/2 specific connector, but rather it adds a HTTP/2 Connection factory to an existing connector. Thus configuring HTTP/2 is a combination of configuring common properties on the connector and HTTP/2 specific properties on the connection factory. The modules and XML files involved can be seen with the following commands:

    $ java -jar $JETTY_HOME/start.jar --list-modules
        ...
        1) alpn-impl  <transitive>
        ...
        2) http            ${jetty.base}/start.d/http.ini
        2) ssl             ${jetty.base}/start.d/ssl.ini
        3) alpn            ${jetty.base}/start.d/alpn.ini
        3) http2c          ${jetty.base}/start.d/http2c.ini
        ...
        4) http2           ${jetty.base}/start.d/http2.ini
        5) https           ${jetty.base}/start.d/https.ini

    $ java -jar $JETTY_HOME/start.jar --list-config
     ...
     ${jetty.home}/etc/jetty-ssl.xml
     ${jetty.home}/etc/jetty-ssl-context.xml
     ${jetty.home}/etc/jetty-alpn.xml
     ${jetty.home}/etc/jetty-http2c.xml
     ${jetty.home}/etc/jetty-http.xml
     ...
     ${jetty.home}/etc/jetty-http2.xml
     ${jetty.home}/etc/jetty-https.xml

The common properties associated with connectors (host,port, timeouts, etc.) can be set in the module ini files (or `start.ini` if `--add-to-start` was used): `${jetty.base}/start.d/http.ini` and `${jetty.base}/start.d/ssl.ini`. These properties are instantiated in the associated XML files: `${jetty.home}/etc/jetty-http.xml`; `${jetty.home}/etc/jetty-ssl.xml`, plus the SSL keystore is instantiated in `${jetty.home}/etc/jetty-ssl-context.xml`.

> ### Note

> If you are planning to edit XML files, make sure to copy them to your `{$jetty.base}/etc/` directory before doing so. The XML files that come with the Jetty distribution should not be modified directly.

HTTP/2 specific properties can be set in the module ini files: `${jetty.base}/start.d/http2.ini` and `${jetty.base}/start.d/http2c.ini`, which are instantiated in the associated XML files: `${jetty.home}/etc/jetty-http2.xml`; `${jetty.home}/etc/jetty-http2c.xml`, respectively. Currently there are very few HTTP/2 configuration properties and the default values are reasonable:

Table 16.1. HTTP/2 Configuration Properties

Property | Description
--- | ---
jetty.http2.maxConcurrentStreams | The maximum number of concurrently open streams allowed on a single HTTP/2 connection (default 128). Larger values increase parallelism but cost a memory commitment.
jetty.http2.initialSessionRecvWindow | The initial receive flow control window size for a new session (default 1048576). Larger values may allow greater throughput but also risk head of line blocking if TCP/IP flow control is triggered.
jetty.http2.initialStreamRecvWindow | The initial receive flow control window size for a new stream (default 524288). Larger values may allow greater throughput but also risk head of line blocking if TCP/IP flow control is triggered.

Previous | Top | Next
Enabling HTTP/2 | Home | Configuring HTTP/2 Push

See an error or something missing? Contribute to this documentation at Github!(Generated: 2020-09-30)