Skip to content

Commit d92e9e3

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into us429364-seo-top25-vnet
2 parents b2abe27 + 8cca9e8 commit d92e9e3

File tree

5 files changed

+108
-33
lines changed

5 files changed

+108
-33
lines changed

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

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,68 @@ services: application-gateway
55
author: mbender-ms
66
ms.service: azure-application-gateway
77
ms.topic: how-to
8-
ms.date: 04/12/2019
8+
ms.date: 07/09/2025
99
ms.author: mbender
1010
ms.custom: devx-track-azurepowershell
1111
# Customer intent: "As a cloud administrator, I want to configure HTTP header rewrites using Azure PowerShell, so that I can efficiently modify headers in requests and responses for my Application Gateway."
1212
---
1313
# Rewrite HTTP request and response headers with Azure Application Gateway - Azure PowerShell
1414

15-
This article describes how to use Azure PowerShell to configure an [Application Gateway v2 SKU](./application-gateway-autoscaling-zone-redundant.md) instance to rewrite the HTTP headers in requests and responses.
15+
This article describes how to use Azure PowerShell to configure an [Application Gateway v2 SKU](./application-gateway-autoscaling-zone-redundant.md) instance to rewrite HTTP headers in requests and responses. Header rewriting enables you to add, remove, or update HTTP headers while the request and response packets move between the client and backend pools.
1616

1717
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
1818

19-
## Before you begin
19+
## Prerequisites
2020

21-
- You need to run Azure PowerShell locally to complete the steps in this article. You also need to have Az module version 1.0.0 or later installed. Run `Import-Module Az` and then `Get-Module Az` to determine the version that you have installed. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). After you verify the PowerShell version, run `Login-AzAccount` to create a connection with Azure.
22-
- You need to have an Application Gateway v2 SKU instance. Rewriting headers isn't supported in the v1 SKU. If you don't have the v2 SKU, create an [Application Gateway v2 SKU](./tutorial-autoscale-ps.md) instance before you begin.
21+
Before you begin, ensure you have the following requirements:
2322

24-
## Create required objects
23+
- **Azure PowerShell**: You need Azure PowerShell installed locally or access to Azure Cloud Shell. The Azure PowerShell Az module version 1.0.0 or later is required. To check your version, run `Get-Module -ListAvailable Az`. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell).
24+
- **Azure connection**: After verifying the PowerShell version, run `Connect-AzAccount` to authenticate with Azure.
25+
- **Application Gateway v2**: You need an existing Application Gateway v2 SKU instance. Header rewriting is only supported in the v2 SKU (Standard_v2 or WAF_v2). If you don't have one, create an [Application Gateway v2 SKU](./tutorial-autoscale-ps.md) instance before you begin.
26+
- **Proper permissions**: Ensure you have Contributor or Owner permissions on the Application Gateway resource.
2527

26-
To configure HTTP header rewrite, you need to complete these steps.
28+
> [!IMPORTANT]
29+
> Header rewrite functionality is only available with Application Gateway v2 SKU. The v1 SKU doesn't support this feature.
2730
28-
1. Create the objects that are required for HTTP header rewrite:
31+
## Understanding HTTP header rewrite components
2932

30-
- **RequestHeaderConfiguration**: Used to specify the request header fields that you intend to rewrite and the new value for the headers.
33+
To configure HTTP header rewrite, you need to understand and create the following components in a specific order:
3134

32-
- **ResponseHeaderConfiguration**: Used to specify the response header fields that you intend to rewrite and the new value for the headers.
35+
### Core components
3336

34-
- **ActionSet**: Contains the configurations of the request and response headers specified previously.
37+
1. **RequestHeaderConfiguration**: Specifies the request header fields you want to rewrite and their new values. Use this component to modify headers in client requests before they reach the backend servers.
3538

36-
- **Condition**: An optional configuration. Rewrite conditions evaluate the content of HTTP(S) requests and responses. The rewrite action will occur if the HTTP(S) request or response matches the rewrite condition.
39+
2. **ResponseHeaderConfiguration**: Specifies the response header fields you want to rewrite and their new values. Use this component to modify headers in server responses before they reach the client.
3740

38-
If you associate more than one condition with an action, the action occurs only when all the conditions are met. In other words, the operation is a logical AND operation.
41+
3. **ActionSet**: Contains the configurations of the request and response headers specified. Each action set represents a collection of header modifications to perform.
42+
43+
- **Condition**: An optional configuration. Rewrite conditions evaluate the content of HTTP(S) requests and responses. The rewrite action occurs if the HTTP(S) request or response matches the rewrite condition.
3944

40-
- **RewriteRule**: Contains multiple rewrite action / rewrite condition combinations.
45+
> [!NOTE]
46+
> Multiple conditions associated with an action use logical AND operation - all conditions must be met for the action to execute.
4147
42-
- **RuleSequence**: An optional configuration that helps determine the order in which rewrite rules execute. This configuration is helpful when you have multiple rewrite rules in a rewrite set. A rewrite rule that has a lower rule sequence value runs first. If you assign the same rule sequence value to two rewrite rules, the order of execution is non-deterministic.
48+
5. **RewriteRule**: Combines multiple rewrite actions and rewrite conditions. Each rule defines when and how to modify headers.
4349

44-
If you don't specify the RuleSequence explicitly, a default value of 100 is set.
50+
6. **RuleSequence** (Optional): Determines the execution order when you have multiple rewrite rules in a rewrite set. Rules with lower sequence values execute first. If you don't specify a value, the default is 100.
4551

46-
- **RewriteRuleSet**: Contains multiple rewrite rules that will be associated to a request routing rule.
52+
> [!WARNING]
53+
> If you assign the same sequence value to multiple rules, the execution order becomes non-deterministic.
4754
48-
2. Attach the RewriteRuleSet to a routing rule. The rewrite configuration is attached to the source listener via the routing rule. When you use a basic routing rule, the header rewrite configuration is associated with a source listener and is a global header rewrite. When you use a path-based routing rule, the header rewrite configuration is defined on the URL path map. In that case, it applies only to the specific path area of a site.
55+
7. **RewriteRuleSet**: Contains multiple rewritten rules that are associated with a request routing rule.
4956

50-
You can create multiple HTTP header rewrite sets and apply each rewrite set to multiple listeners. But you can apply only one rewrite set to a specific listener.
57+
### Application scope
5158

52-
## Sign in to Azure
59+
The rewrite configuration scope depends on the routing rule type:
60+
61+
- **Basic routing rule**: Header rewrite configuration applies globally to all requests for the associated listener
62+
- **Path-based routing rule**: Header rewrite configuration applies only to requests matching specific URL path patterns defined in the URL path map
63+
64+
> [!IMPORTANT]
65+
> You can create multiple HTTP header rewrite sets and apply each set to multiple listeners, but only one rewrite set can be applied to a specific listener.
66+
67+
## Authenticate with Azure
68+
69+
Before configuring header rewrite rules, authenticate with Azure and select your subscription:
5370

5471
```azurepowershell
5572
Connect-AzAccount
@@ -58,12 +75,12 @@ Select-AzSubscription -Subscription "<sub name>"
5875

5976
## Specify the HTTP header rewrite rule configuration
6077

61-
In this example, we'll modify a redirection URL by rewriting the location header in the HTTP response whenever the location header contains a reference to azurewebsites.net. To do this, we'll add a condition to evaluate whether the location header in the response contains azurewebsites.net. We'll use the pattern `(https?)://.*azurewebsites.net(.*)$`. And we'll use `{http_resp_Location_1}://contoso.com{http_resp_Location_2}` as the header value. This value will replace *azurewebsites.net* with *contoso.com* in the location header.
78+
In this example, we modify a redirection URL by rewriting the location header in the HTTP response whenever the location header contains a reference to azurewebsite.net. To do this modification, we add a condition to evaluate whether the location header in the response contains azurewebsite.net. We use the pattern `(https?)://.*azurewebsite.net(.*)$`. And we use `{http_resp_Location_1}://contoso.com{http_resp_Location_2}` as the header value. This value replaces *azurewebsite.net* with *contoso.com* in the location header.
6279

6380
```azurepowershell
6481
$responseHeaderConfiguration = New-AzApplicationGatewayRewriteRuleHeaderConfiguration -HeaderName "Location" -HeaderValue "{http_resp_Location_1}://contoso.com{http_resp_Location_2}"
6582
$actionSet = New-AzApplicationGatewayRewriteRuleActionSet -ResponseHeaderConfiguration $responseHeaderConfiguration
66-
$condition = New-AzApplicationGatewayRewriteRuleCondition -Variable "http_resp_Location" -Pattern "(https?):\/\/.*azurewebsites\.net(.*)$" -IgnoreCase
83+
$condition = New-AzApplicationGatewayRewriteRuleCondition -Variable "http_resp_Location" -Pattern "(https?):\/\/.*azurewebsite\.net(.*)$" -IgnoreCase
6784
$rewriteRule = New-AzApplicationGatewayRewriteRule -Name LocationHeader -ActionSet $actionSet -Condition $condition
6885
$rewriteRuleSet = New-AzApplicationGatewayRewriteRuleSet -Name LocationHeaderRewrite -RewriteRule $rewriteRule
6986
```
@@ -74,32 +91,51 @@ $rewriteRuleSet = New-AzApplicationGatewayRewriteRuleSet -Name LocationHeaderRew
7491
$appgw = Get-AzApplicationGateway -Name "AutoscalingAppGw" -ResourceGroupName "<rg name>"
7592
```
7693

77-
## Retrieve the configuration of your request routing rule
94+
## Retrieve request routing rule configuration
95+
96+
Get the specific request routing rule where you want to apply the header rewrite configuration:
7897

7998
```azurepowershell
8099
$reqRoutingRule = Get-AzApplicationGatewayRequestRoutingRule -Name rule1 -ApplicationGateway $appgw
81100
```
82101

83102
## Update the application gateway with the configuration for rewriting HTTP headers
84103

85-
In this example, the rewrite set would be associated instantly against a basic routing rule. In case of a path based routing rule, the association would not be enabled by default. The rewrite set can be enabled either via checking the paths on which it needs to be applied via portal or by providing a URL path map config specifying the RewriteRuleSet against each path option.
104+
In this example, the rewrite set would be associated instantly against a basic routing rule. In a path based routing rule, the association wouldn't be enabled by default. The rewrite set can be enabled either via -- checking the paths on which it needs to be applied via portal or by providing a URL path map config specifying the RewriteRuleSet against each path option.
86105

87106
```azurepowershell
88107
Add-AzApplicationGatewayRewriteRuleSet -ApplicationGateway $appgw -Name $rewriteRuleSet.Name -RewriteRule $rewriteRuleSet.RewriteRules
89108
Set-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $appgw -Name $reqRoutingRule.Name -RuleType $reqRoutingRule.RuleType -BackendHttpSettingsId $reqRoutingRule.BackendHttpSettings.Id -HttpListenerId $reqRoutingRule.HttpListener.Id -BackendAddressPoolId $reqRoutingRule.BackendAddressPool.Id -RewriteRuleSetId $rewriteRuleSet.Id
90109
Set-AzApplicationGateway -ApplicationGateway $appgw
91110
```
92111

93-
## Delete a rewrite rule
112+
## Remove a rewrite rule (Optional)
94113

95-
```azurepowershell
114+
If you need to remove a rewrite rule set from your Application Gateway, use the following steps:
115+
116+
```azurepowershell-interactive
117+
# Retrieve the current Application Gateway configuration
96118
$appgw = Get-AzApplicationGateway -Name "AutoscalingAppGw" -ResourceGroupName "<rg name>"
119+
120+
# Remove the rewrite rule set association from the routing rule first
121+
$requestRoutingRule = Get-AzApplicationGatewayRequestRoutingRule -Name "rule1" -ApplicationGateway $appgw
122+
123+
# Clear the rewrite rule set reference
124+
$requestRoutingRule.RewriteRuleSet = $null
125+
126+
# Remove the rewrite rule set from the Application Gateway
97127
Remove-AzApplicationGatewayRewriteRuleSet -Name "LocationHeaderRewrite" -ApplicationGateway $appgw
98-
$requestroutingrule= Get-AzApplicationGatewayRequestRoutingRule -Name "rule1" -ApplicationGateway $appgw
99-
$requestroutingrule.RewriteRuleSet= $null
100-
set-AzApplicationGateway -ApplicationGateway $appgw
128+
129+
# Apply the changes
130+
Set-AzApplicationGateway -ApplicationGateway $appgw
131+
132+
Write-Output "Rewrite rule set removed successfully"
101133
```
102134

103135
## Next steps
104136

105-
To learn more about how to set up some common use cases, see [common header rewrite scenarios](./rewrite-http-headers-url.md).
137+
Now that you learned how to configure HTTP header rewrite rules, explore these related articles:
138+
139+
- **Common scenarios**: Learn about [common header rewrite scenarios](./rewrite-http-headers-url.md) including security headers, custom routing, and backend server integration patterns.
140+
141+
- **Monitoring and troubleshooting**: Set up [Application Gateway diagnostics](./application-gateway-diagnostics.md) to monitor header rewrite operations and troubleshoot issues.

articles/application-gateway/mutual-authentication-troubleshooting.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ Double check the certificate chain that was uploaded and remove the private key
123123
#### Cause
124124

125125
There are two potential causes for this error:
126+
126127
* **Parsing failure:** The certificate chain isn't in the correct format. Application Gateway expects certificate chains in PEM format with properly delimited individual certificates.
127128
* **Empty content:** The uploaded file contains only delimiters without actual certificate data between them.
128129

129130
#### Solution
130131

131132
Based on the specific cause, apply one of the following solutions:
132-
* **Format issue:** Ensure the certificate chain is in PEM format with each certificate properly delimited by `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` markers. Each certificate should be on separate lines within these delimiters.
133+
134+
* **Format issue:** Ensure the certificate chain is in PEM format with each certificate properly delimited by `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` markers. Each certificate should be on separate lines within these delimiters.
133135
* **Missing data:** Verify that the certificate file contains actual certificate data between the delimiters, not just empty delimiters.
134136

135137
### Error code: ApplicationGatewayTrustedClientCertificateDoesNotContainAnyCACertificate

articles/traffic-manager/traffic-manager-subnet-override-cli.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,28 @@ az network traffic-manager endpoint update \
6868
--remove subnets \
6969
--type AzureEndpoints
7070
```
71+
### IPv6 Subnet Mapping Examples ###
72+
You can also configure subnet mapping using IPv6 address ranges. Use the --type parameter with IPv6 and specify IPv6 addresses in CIDR or range format.
73+
74+
```azurecli-interactive
75+
### Add an IPv6 Subnet in CIDR Notation ###
76+
az network traffic-manager endpoint update \
77+
--resource-group MyResourceGroup \
78+
--profile-name MyTmProfile \
79+
--endpoint-name MyEndpoint \
80+
--type IPv6 \
81+
--subnets 2001:0db8:1234:5678::/64 \
82+
--endpoint-type ExternalEndpoints
83+
84+
### Add a range of IPs ###
85+
az network traffic-manager endpoint update \
86+
--resource-group MyResourceGroup \
87+
--profile-name MyTmProfile \
88+
--endpoint-name MyEndpoint \
89+
--type IPv6 \
90+
--subnets 2001:0db8:abcd:1234::1-2001:0db8:abcd:1234::ffff \
91+
--endpoint-type ExternalEndpoints
92+
```
7193

7294
## Next Steps
7395

articles/traffic-manager/traffic-manager-subnet-override-powershell.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ To create a Traffic Manager subnet override, you can use Azure PowerShell to add
6969
7070
### Add a range of IPs with a subnet ###
7171
Add-AzTrafficManagerIPAddressRange -TrafficManagerEndpoint $TrafficManagerEndpoint -First "12.13.14.0" -Last "12.13.14.31" -Scope 27
72-
72+
73+
### Add a range of IPv6 IPs ###
74+
Add-AzTrafficManagerIPAddressRange -TrafficManagerEndpoint $TrafficManagerEndpoint -First "2001:0db8:85a3::1" -Last "2001:0db8:85a3::ffff"
75+
7376
```
7477
7578
### Update Endpoint
@@ -109,6 +112,9 @@ Set-AzTrafficManagerEndpoint -TrafficManagerEndpoint $TrafficManagerEndpoint
109112
### Remove a range of IPs with a subnet ###
110113
Remove-AzTrafficManagerIpAddressRange -TrafficManagerEndpoint $TrafficManagerEndpoint -First "12.13.14.0"
111114
115+
### Remove a range of IPv6 IPs ###
116+
Remove-AzTrafficManagerIpAddressRange -TrafficManagerEndpoint $TrafficManagerEndpoint -First "2001:0db8:85a3::1"
117+
112118
```
113119
114120
### Update Endpoint

articles/virtual-wan/how-to-routing-policies.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,22 @@ Using the sample VPN configuration and VPN site from above, create firewall rule
367367

368368
#### Performance for Encrypted ExpressRoute
369369

370-
Configuring private routing policies with Encrypted ExpressRoute routes VPN ESP packets through the next hop security appliance deployed in the hub. As a result, you can expect Encrypted ExpressRoute maximum VPN tunnel throughput of 1 Gbps in both directions (inbound from on-premises and outbound from Azure). To achieve the maximum VPN tunnel throughput, consider the following deployment optimizations:
370+
Configuring private routing policies with Encrypted ExpressRoute routes VPN ESP packets through the next hop security appliance deployed in the hub. Encrypted ExpressRoute performance is impacted by two main factors:
371+
* You can expect Encrypted ExpressRoute VPN tunnels to have a maximum throughput of 1 Gbps due to ESP traffic being forwarded through the next hop security appliance deployed in the Virtual WAN hub.
372+
* In practice, Encrypted ExpressRoute VPN tunnel throughput is also impacted by the maximum per-tunnel packets-per-second (PPS) supported by the VPN Gateway scale unit. For smaller packet sizes, you may see lower tunnel throughput. See [Site-to-site VPN performance](virtual-wan-faq.md#packets) for more information.
373+
374+
375+
To achieve the maximum VPN tunnel throughput, consider the following deployment optimizations:
371376

372377
* Deploy Azure Firewall Premium instead of Azure Firewall Standard or Azure Firewall Basic.
373378
* Ensure Azure Firewall processes the rule that allows traffic between the VPN tunnel endpoints (192.168.1.4 and 192.168.1.5 in the example above) first by making the rule have the highest priority in your Azure Firewall policy. For more information about Azure Firewall rule processing logic, see [Azure Firewall rule processing logic](../firewall/rule-processing.md#rule-processing-using-firewall-policy).
374379
* Turn off deep-packet for traffic between the VPN tunnel endpoints. For information on how to configure Azure Firewall to exclude traffic from deep-packet inspection, reference [IDPS bypass list documentation](../firewall/premium-features.md#idps).
375380
* Configure VPN devices to use GCMAES256 for both IPSEC Encryption and Integrity to maximize performance.
376381

382+
To achieve maximum aggregate throughput, consider the following optimization:
383+
384+
* To increase throughput between a single on-premises site and Azure, create multiple tunnels between on-premises devices and the Site-to-site VPN Gateway in Virtual WAN. Ensure your on-premises VPN device is configured to load-balance traffic across all active tunnels.
385+
377386
#### Direct routing to NVA instances for dual-role connectivity and firewall NVAs
378387

379388
> [!NOTE]

0 commit comments

Comments
 (0)