On this page

Last updated: November 28, 2026

HTTP/2 and gRPC

Every web service has an HTTP protocol: what the app accepts on its port.

ProtocolWhen to use it
HTTP/1.1The default. Suits most web apps and APIs.
HTTP/2The app accepts HTTP/2 without TLS (h2c) and you want HTTP/2 end to end.
gRPCThe app is a gRPC server: unary calls and server, client and bidirectional streams.

With HTTP/2 or gRPC, traffic to your domains on Guara DNS reaches the app over HTTP/2 all the way, streams that stay open for hours included.

Requirements

  • The app accepts HTTP/2 without TLS (h2c) on the service port. Guara ends TLS and speaks h2c to the app. gRPC servers do this when they start without TLS credentials, as in the examples below. An app that only speaks HTTP/1.1 stops responding if you pick HTTP/2 or gRPC.
  • Domains on Guara DNS. End-to-end HTTP/2 and gRPC work only on domains in a Guara DNS zone of the same account. Domains pointed by another DNS provider go through Cloudflare, which doesn’t forward gRPC.

Choose the protocol

  1. Open the service settings

    On the service page, open Settings and find HTTP protocol in the Endpoints card.

  2. Pick the protocol

    Click HTTP/2 or gRPC. The dashboard shows what changes and asks you to confirm.

  3. Add the domain

    In the Domains tab, add a domain on Guara DNS, such as api.example.com. Guara issues a Let’s Encrypt certificate and publishes the records. The domain turns Active within a few minutes.

With the CLI:

guara services http-protocol grpc --project my-project --service my-api
guara domains add --domain api.example.com --project my-project --service my-api

You can also create the service with the protocol set: guara services create ... --http-protocol grpc.

Changing the protocol doesn’t restart the pods: the routes change within seconds.

Ports

  • Clients connect on port 443, with TLS and ALPN h2. Port 80 redirects to https://.
  • Your app receives h2c, without TLS, on the port set on the service.

There are no other ports to open and no certificates to set up in the app.

Long-lived streams

Routes of HTTP/2 and gRPC services have no time limit for reading the request, so client and bidirectional streams can stay open for hours. A stream with no traffic stays open too.

If the app hangs in the middle of a stream, Guara notices within a minute and ends the stream, so the client reconnects instead of waiting forever.

Recommendations:

  • Client keepalive. Set keepalive pings (every 30 seconds, for example) to detect networks that drop without notice.
  • Server keepalive policy. gRPC servers refuse pings that come too often by default. In grpc-go, for example, the minimum is 5 minutes, and a client that pings more often gets GOAWAY with too_many_pings. Set the server’s EnforcementPolicy to the client’s interval.
  • Reconnect. Treat UNAVAILABLE and INTERNAL at the end of a stream as a signal to reconnect, as on any network.

Server examples

All three examples listen with h2c on port 50051. Set that port on the service.

// Go (grpc-go)
lis, _ := net.Listen("tcp", ":50051")
s := grpc.NewServer(
	grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
		MinTime:             20 * time.Second,
		PermitWithoutStream: true,
	}),
)
pb.RegisterGreeterServer(s, &server{})
s.Serve(lis)
// Node.js (@grpc/grpc-js)
const server = new grpc.Server();
server.addService(greeterProto.Greeter.service, { sayHello });
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {});
# Python (grpcio)
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
greeter_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server)
server.add_insecure_port("[::]:50051")
server.start()
server.wait_for_termination()

Test

With reflection enabled on the server:

grpcurl api.example.com:443 list
grpcurl -d '{"name": "Guara"}' api.example.com:443 helloworld.Greeter/SayHello

Without reflection, pass the .proto with -proto greeter.proto.

What differs from HTTP/1.1

  • Compression. With gRPC, the platform doesn’t compress responses; gRPC has its own compression. With HTTP/2, responses stay compressed when the client accepts it.
  • The Guara edge instead of Cloudflare. The service’s domains arrive through Guara’s own entry point in São Paulo, like wildcard domains. Cloudflare rules, WAF and cache don’t apply to them.
  • _acme-challenge is reserved. Guara uses _acme-challenge.<domain> to validate the certificate, and the DNS editor doesn’t allow records at that name.
  • Moving the service to another project. A service with domains served by the edge can’t move to another project. Remove the domains, move the service, then add the domains again.

Going back to HTTP/1.1, or changing with domains already added

Domains don’t change path with the protocol. To switch between HTTP/1.1 and HTTP/2/gRPC on a service that already has custom domains, remove those domains, change the protocol, then add the domains again. The dashboard and the CLI show which domains have to go. Switching between HTTP/2 and gRPC is direct, and wildcard domains never have to go.