This template illustrates different redirect scenarios Application Gateway supports:
- Redirect http requests to https.
- Redirect requests to a fixed url.
- Redirect requests under a given path.
This functionality can be configured using RedirectConfiguration.
Property | Mandatory | Description |
---|---|---|
RedirectType | Y | Supported http redirection types - Permanent, Temporary, Found, SeeOther |
TargetListener | N | Reference to a listener to redirect the request to. |
TargetUrl | N | A Url to redirect to. Cannot be used when TargetListener is specified. |
IncludePath | N | True/False. |
IncludeQueryString | N | True/False |
{
"redirectConfigurations": [
{
"Name": "redirectConfig1",
"properties": {
"redirectType": "Found",
"targetListener": {
"id": "[concat(variables('applicationGatewayID'), '/httpListeners/appGatewayHttpsListener1')]"
}
}
}
]
}
A RedirectConfiguration can be associated with either a listener in a basic rule, Or a Pathrule in UrlPathMap.
{
"requestRoutingRules": [
{
"Name": "rule1",
"properties": {
"RuleType": "Basic",
"httpListener": {
"id": "[concat(variables('applicationGatewayID'), '/httpListeners/appGatewayHttpListener1')]"
},
"redirectConfiguration": {
"id": "[concat(variables('applicationGatewayID'), '/redirectConfigurations/redirectConfig1')]"
}
}
}
]
}
{
"urlPathMaps": [
{
"name": "urlPathMap1",
"properties": {
"defaultRedirectConfiguration": {
"id": "[concat(variables('applicationGatewayID'), '/redirectConfigurations/redirectConfig2')]"
},
"pathRules": [
{
"name": "pathRule1",
"properties": {
"paths": [
"[parameters('pathMatch1')]"
],
"redirectConfiguration": {
"id": "[concat(variables('applicationGatewayID'), '/redirectConfigurations/redirectConfig1')]"
}
}
}
]
}
}
]
}
Supported apiVersion to use http redirect feature is "2017-04-01" and above.