Skip to content

Commit aec267b

Browse files
committed
Add HTTP header rewrite PowerShell documentation improvements
- Improved PowerShell code examples with interactive syntax - Enhanced technical explanations and structure - Added better error handling and user feedback in code examples - Updated removal/deletion section with clearer instructions - Minor technical accuracy improvements throughout
1 parent 906a6da commit aec267b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

articles/application-gateway/add-http-header-rewrite-rule-powershell.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,25 @@ Set-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $appgw -Name $req
109109
Set-AzApplicationGateway -ApplicationGateway $appgw
110110
```
111111

112-
### Verification steps
112+
## Delete a rewrite rule
113113

114-
After applying or removing rewrite rules, verify the configuration:
114+
To remove a rewrite rule set from your Application Gateway configuration:
115115

116-
```azurepowershell
116+
```azurepowershell-interactive
117+
# Retrieve the current Application Gateway configuration
117118
$appgw = Get-AzApplicationGateway -Name "AutoscalingAppGw" -ResourceGroupName "<rg name>"
119+
120+
# Remove the rewrite rule set from the Application Gateway
118121
Remove-AzApplicationGatewayRewriteRuleSet -Name "LocationHeaderRewrite" -ApplicationGateway $appgw
119-
$requestroutingrule= Get-AzApplicationGatewayRequestRoutingRule -Name "rule1" -ApplicationGateway $appgw
120-
$requestroutingrule.RewriteRuleSet= $null
121-
set-AzApplicationGateway -ApplicationGateway $appgw
122+
123+
# Get the request routing rule and clear the rewrite rule set reference
124+
$requestroutingrule = Get-AzApplicationGatewayRequestRoutingRule -Name "rule1" -ApplicationGateway $appgw
125+
$requestroutingrule.RewriteRuleSet = $null
126+
127+
# Apply the configuration changes
128+
Set-AzApplicationGateway -ApplicationGateway $appgw
129+
130+
Write-Output "Rewrite rule set 'LocationHeaderRewrite' has been removed successfully"
122131
```
123132

124133
## Next steps

0 commit comments

Comments
 (0)