Use HTTP/2 connections for App Service apps#
Performance Efficiency · App Service · 2020_12
Use HTTP/2 instead of HTTP/1.x to improve protocol efficiency.
Description#
Azure App Service has native support for HTTP/2, but by default it is disabled. HTTP/2 offers a number of improvements over HTTP/1.1, including:
- Connections are fully multiplexed, instead of ordered and blocking.
- Connections are reused, reducing connection establishment overhead.
- Headers are compressed to reduce overhead.
Recommendation#
Consider using HTTP/2 for Azure Services apps to improve protocol efficiency.
Examples#
Configure with Azure template#
To deploy App Services that pass this rule:
- Set
properties.siteConfig.http20Enabled
totrue
.
For example:
Azure Template snippet
{
"type": "Microsoft.Web/sites",
"apiVersion": "2021-02-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"kind": "web",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('planName'))]",
"httpsOnly": true,
"siteConfig": {
"alwaysOn": true,
"minTlsVersion": "1.2",
"ftpsState": "FtpsOnly",
"remoteDebuggingEnabled": false,
"http20Enabled": true
}
},
"tags": "[parameters('tags')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('planName'))]"
]
}
Configure with Bicep#
To deploy App Services that pass this rule:
- Set
properties.siteConfig.http20Enabled
totrue
.
For example:
Azure Bicep snippet
resource webApp 'Microsoft.Web/sites@2021-02-01' = {
name: name
location: location
kind: 'web'
properties: {
serverFarmId: appPlan.id
httpsOnly: true
siteConfig: {
alwaysOn: true
minTlsVersion: '1.2'
ftpsState: 'FtpsOnly'
remoteDebuggingEnabled: false
http20Enabled: true
}
}
tags: tags
}
Links#
Last update:
2022-11-27