Use HTTP/2 for services Stay organized with collections Save and categorize content based on your preferences.
When a container instance receives requests, Cloud Run downgradesthose requests from HTTP/2 to HTTP/1 with the exception of native gRPC traffic,which requires HTTP/2 to function correctly. This page shows you how to configureyour service to use end-to-end HTTP/2, which prevents Cloud Run fromdowngrading requests to HTTP1.
For more information about invoking services using HTTP, seeInvoking with an HTTPS Request.
Before you configure
Your Cloud Run service must handle requests inHTTP/2 cleartext(h2c) format. Google's frontend-servinginfrastructure terminates TLS and then forwards theh2c traffic to Cloud Runand to your container through an encrypted channel.
To confirm that your service supportsh2c requests,test the service locally using this curl command:
curl-i--http2-prior-knowledgehttp://localhost:PORT
Required roles
To get the permissions that you need to configure and deploy Cloud Run services, ask your administrator to grant you the following IAM roles:
- Cloud Run Developer (
roles/run.developer) on the Cloud Run service - Service Account User (
roles/iam.serviceAccountUser) on the service identity
If you are deploying aserviceorfunction from source code, youmust also have additional roles granted to you on your project andCloud Build service account.
For a list of IAM roles and permissions that are associated withCloud Run, seeCloud Run IAM rolesandCloud Run IAM permissions.If your Cloud Run service interfaces withGoogle Cloud APIs, such as Cloud Client Libraries, see theservice identity configuration guide.For more information about granting roles, seedeployment permissionsandmanage access.
Supported HTTP/2 services
HTTP/2 is ideal for a variety of applications. Some common use cases includethe following:
- gRPC services: build high-performance, low-latency microservices thatcommunicate usinggRPC.
- APIs with high throughput: reduce overhead for applications that requireefficient handling of numerous small requests or need to push data to clients.
Set and update HTTP/2 end-to-end
Any configuration change leads to thecreation of a new revision. Subsequent revisions will also automatically getthis configuration setting unless you make explicit updates to change it.
You can specify the use of HTTP/2 end-to-end by using the Google Cloud console,Google Cloud CLI, or YAML when youcreate a new service ordeploy a new revision:
Console
In the Google Cloud console, go to Cloud Run:
SelectServices from the Cloud Run navigation menu, and clickDeploy container to configure a new service.If you are configuring an existing service, click theservice, then clickEdit and deploy new revision.
If you are configuring a new service, fill out the initial servicesettings page, then clickContainer(s), Volumes, Networking, Security to expand theservice configuration page.
Click theNetworking tab.

- SelectEnable http/2 connections. Make your custom container image supports HTTP/2 requests.
ClickCreate orDeploy.
gcloud
You canupdatea given service to use HTTP/2 by using the following command:
gcloudrunservicesupdateSERVICE--use-http2
ReplaceSERVICE with the name of your service.
You can also set your service to use HTTP/2 duringdeployment using the command:
gcloudrundeploy--imageIMAGE_URL--use-http2
ReplaceIMAGE_URL with a reference to your custom container image that supports HTTP/2 requests.
YAML
If you are creating a new service, skip this step.If you are updating an existing service, download itsYAML configuration:
gcloudrunservicesdescribeSERVICE--formatexport>service.yamlUpdate
portswith the nameh2candcontainerPortwith the port ofyour choice, as shown in the following example:apiVersion:serving.knative.dev/v1kind:Servicemetadata:name:SERVICEspec:template:metadata:name:REVISIONspec:containers:-image:IMAGE_URLports:-name:h2ccontainerPort:8080
Replace the following:
- SERVICE: the name of your Cloud Run service
- IMAGE_URL: a reference to your custom container image that supports HTTP/2 requests
- REVISION with a new revision name or delete it (if present). If you supply a new revision name, itmust meet the following criteria:
- Starts with
SERVICE- - Contains only lowercase letters, numbers and
- - Does not end with a
- - Does not exceed 63 characters
- Starts with
Create or update the service using the following command:
gcloudrunservicesreplaceservice.yaml
Terraform
To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.
Add the following to agoogle_cloud_run_v2_service resource in your Terraform configuration:resource"google_cloud_run_v2_service""default"{name="cloudrun-service-h2c"location="us-central1"deletion_protection=false # set to "true" in productiontemplate{containers{image=IMAGE_URL # Enable HTTP/2ports{name="h2c"container_port=8080}}}}ReplaceIMAGE_URL with a reference to your custom container image that supports HTTP/2 requests.
If your container listens for HTTP requests on a port other than8080,replace8080 with that port number.
View http/2 settings
To view the current http/2 settings for yourCloud Run service:
Console
In the Google Cloud console, go to the Cloud RunServices page:
Click the service you are interested in to open theService detailspage.
Click theRevisions tab.
In the details panel at the right, the http/2 settingis listed under theNetworking tab.
gcloud
Use the following command:
gcloudrunservicesdescribeSERVICE
Locate the http/2 setting in the returnedconfiguration.
Use HTTP/2 behind a load balancer
When configured to listen for HTTP/2, Cloud Run automaticallyhandles the HTTP/2 or gRPC traffic arriving from the Application Load Balancer. Nospecific configuration is needed on the load balancer's backend service.
To configure Cloud Run to use HTTP/2 or gRPC, use one of thefollowing methods:
- Set and update HTTP/2 end-to-end
- Configure anexternal Application Load Balancer with yourCloud Run service as the backend.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.