I have configured an Application Gateway (AG) to do SSL termination/offload. The AG is configured to only listen on port 443 for HTTPS connections. Is it possible to redirect HTTP to HTTPS without having to:
I'm hoping I overlooked a flag/feature in AG.
To expand on @jonathan-mas answer,
This can be done using command line only (as of Dec 2017). I don't prefer the Powershell approach (limited portability), I prefer AZ CLI as it is more direct in answering this question.
Create a listener for your HTTP traffic (e.g. FE-HTTP-80-Site
). This can be done using Azure portal or CLI.
Create a listener for your HTTPS traffic (e.g. FE-HTTPS-443-Site
). This can be done in Azure portal or CLI.
Create a redirect configuration:
az network application-gateway redirect-config create \
--gateway-name AppGateway \
-g RSgroupAppGateway \
-n Redirect-Site-toHTTPS \
--type Permanent \
--include-path true \
--include-query-string true \
--target-listener FE-HTTPS-443-Site
az network application-gateway rule create \
--gateway-name AppGateway \
-g RSgroupAppGateway \
-n Rule-HTTP-80-Site \
--rule-type Basic \
--http-listener FE-HTTP-80-Site \
--redirect-config Redirect-Site-toHTTPS
Reference on Concept: https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-configure-redirect-powershell
AZ CLI Reference: https://docs.microsoft.com/en-us/cli/azure/