How to configure HTTP to HTTPS redirection in Azure Application Gateway

Case #

There are many cases in which you need to redirect all HTTP traffic hitting your Azure infrastructure to HTTPS for security reasons. This article provides step-by-step guidance on how to configure HTTP to HTTPS redirection in Azure Application Gateway.

Solution #

Step 1 - Create Application Gateway listeners #

Create a port 80 HTTP listener and a port 443 listener for each Application Gateway services you wish to perform HTTP to HTTPS redirection, as shown in the example below.

Port 443 listener
Port 80 listener

Each port 443 listener (HTTPS) should have all dependent Application Gateway components configured as well, namely at least one backend pool, one backet settings object, one rule and one health probe. More details on how to configure the Azure Application Gateway components for HTTPS workloads can be found in the following KB article: https://stefanos.cloud/kb/how-to-configure-azure-application-gateway-for-https-workloads/.

Step 2 - Create Application Gateway rules for the HTTP to HTTPS redirection #

For each port 80 listener, create an Application Gateway rule which redirects all traffic intercepted by the port 80 listener to the corresponding port 443 listener, as shown in the example below.

HTTP to HTTPS redirection rule - part 1
HTTP to HTTPS redirection rule - part 2

Powered by BetterDocs