Fix GCP Cloud Run Run Http2 Errors
When working with GCP Cloud Run, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with run http2 and shows the exact fix.
A Common Mistake
Deploying a Cloud Run service that uses HTTP/2 without enabling the HTTP/2 endpoint setting, causing clients to fall back to HTTP/1.1 and losing HTTP/2 benefits.
The incorrect command:
gcloud run deploy my-service --image=gcr.io/my-project/my-image --port=8080
Error output:
Deployed with HTTP/1.1.
Clients that support HTTP/2 (like gRPC or modern browsers) negotiate down to HTTP/1.1. Features like multiplexing, server push, and header compression are not available. gRPC calls fail because gRPC requires HTTP/2.
The Correct Approach
The right way to configure run http2 in GCP Cloud Run:
gcloud run deploy my-service --image=gcr.io/my-project/my-image --port=8080 --use-http2
Successful result:
Deployed with HTTP/2 endpoint.
Clients can use HTTP/2. gRPC works. Multiplexing reduces latency. Server push is available for web assets. The endpoint listens for HTTP/2 connections on port 8080.
How to Prevent This
Enable --use-http2 for gRPC services, gRPC-web, or services benefiting from HTTP/2 multiplexing. HTTP/2 alone does not enable gRPC -- the application must also support gRPC. HTTP/2 endpoints in Cloud Run use H2C (no TLS termination). HTTPS is still enforced at the ingress.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro