Review Function App HTTP/2 settings

Review the need for HTTP/2 and client compatibility, and check HTTPS protection separately.

Description

If function clients need HTTP/2 multiplexing, set site_config.http2_enabled = true. The HTTP version used for a request depends on negotiation with the client.

Potential impact

Calls that fall back to HTTP/1.1 may miss expected transfer efficiencies or operating requirements. HTTP/1.1 connections can still use HTTPS.

Remediation

Call the function with the clients you support and check the negotiated protocol. Review HTTPS enforcement, minimum TLS and caller authentication separately. If you use client certificates, avoid settings that require TLS renegotiation, which HTTP/2 does not support.

Examples

The AzureRM 3.x azurerm_function_app excerpts omit required storage settings. The .NET and deployment settings shown alongside http2_enabled belong to the example environment. Use a supported runtime for your deployment.

Before

hcl
resource "azurerm_function_app" "example" {
  name                = "test-azure-functions"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id
}

After

hcl
resource "azurerm_function_app" "example" {
  name                = "test-azure-functions"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id

  site_config {
    dotnet_framework_version = "v4.0"
    scm_type                 = "LocalGit"
    http2_enabled            = true
  }
}

References