HTTP/2
Configure a service to use HTTP/2.
You might have services in your Kubernetes cluster that use HTTP/2 for communication. Typically these are gRPC services, but it could apply to any service that uses HTTP/2 in its transport layer. To enable HTTP/2 communication, you simply set the app protocol on the service to HTTP/2. This setting instructs Gloo Gateway to use HTTP/2 for communication with the destination.
Before you begin
Follow the Get started guide to install Gloo Gateway, set up a gateway resource, and deploy the httpbin sample app.
Get the external address of the gateway and save it in an environment variable.
Deploy a sample app
To demonstrate the HTTP/2 routing capabilities, deploy a sample nginx server and configure it to only accept HTTP/2 connections.
Deploy a simple nginx server that is configured to use the HTTP/2 protocol. Note that in this example, the
appProtocol
on the nginx service is set tohttp2
. Other supported values to configure the HTTP/2 protocol includegrpc
,grpc-web
, orkubernetes.io/h2c
.Verify that the nginx server is up and running.
Example output:
Create an HTTPRoute to expose the nginx server on the Gateway.
Send a request to the nginx server and include the
--http2-prior-knowledge
to send an HTTP/2 request to the Gateway. Verify that the request succeeds and that you get back a 200 HTTP response code.Example output: