API Gateway supports HTTP/2 and provides features such as multiplexing of requests and responses and header compression.
- Multiplexing: In HTTP 1.x, sending and parallel processing of requests and responses require multiple TCP connections. However, in HTTP/2, a sender can divide an HTTP request or response into independent frames, send them in disordered streams to a receiver, and then recombine the streams at the receiver. This reduces latency and improves efficiency. Even when a client needs to send a large amount of request data, the client can transmit the request data by using a single or a few TCP connections.
- Header compression: The header of an HTTP request contains a large amount of data. In HTTP 1.x, each HTTP request must include a complete header. In HTTP/2, header field tables are created after a connection is established between a client and a server. The header field tables are used to store key-value pairs in the header of each HTTP message. If a key-value pair in the header of an HTTP message already exists in the header field tables, the key-value pair will not be sent to the receiver with the rest of the message. The header field tables are updated every time an HTTP message is sent, and deleted only after the client and the server are disconnected. Each new key-value pair is added to the end of the header field tables or replaces an existing key-value pair with the same key name. The header field tables help reduce the amount of data in each HTTP request.
Enable HTTP/2 for an API group
Enable HTTP/2 for an API group that is created after July 14, 2017
All API operations that support HTTPS requests automatically use HTTP/2 for communication between clients and API Gateway. HTTP/2 can be used only by API operations that support HTTPS requests. Therefore, if you want an API operation to use HTTP/2, you must enable HTTPS for the API operation. For more information, see Access a domain name by using HTTPS.
Enable HTTP/2 for an API group that was created before July 14, 2017
HTTP/2 is not supported by API groups that were created before July 14, 2017. You will soon be able to manually enable HTTP/2 for an API group that was created before July 14, 2017.