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 Mast's answer,
This can be done using the 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 the 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: Create an application gateway with URL path-based redirection using Azure PowerShell
AZ CLI Reference: Azure Command-Line Interface (CLI) documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With