Skip to content

Commit 7edfd62

Browse files
Merge pull request #302324 from craigshoemaker/aca/waf-gateway-updates
[Container Apps] Update: WAF Gateway -> add request header rewrite section
2 parents 45dffe8 + 907efa7 commit 7edfd62

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

articles/container-apps/waf-app-gateway.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: container-apps
55
author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.topic: how-to
8-
ms.date: 04/28/2025
8+
ms.date: 07/07/2025
99
ms.author: cshoe
1010
---
1111

@@ -190,7 +190,7 @@ The backend pool is used to route requests to the appropriate backend servers. B
190190
- Internal IP addresses
191191
- Virtual Machine Scale Sets
192192
- Fully qualified domain names (FQDN)
193-
- Multi-tenant back-ends like Azure App Service and Container Apps
193+
- Multitenant back-ends like Azure App Service and Container Apps
194194

195195
In this example, you create a backend pool that targets your container app.
196196

@@ -278,6 +278,15 @@ To connect the frontend and backend pool, perform the following steps:
278278
| Host name override | Select **Pick host name from backend target**. |
279279
| Create custom probes | Select **No**. |
280280

281+
1. Under **Request Header Rewrite**, configure the following:
282+
283+
- Enable Request Header Rewrite: Select **Yes**.
284+
- Add a request header:
285+
- Header name: `X-Forwarded-Host`
286+
- Value: `{host}`
287+
288+
This action ensures that the original `Host` header from the client request is preserved and accessible by the backend application.
289+
281290
1. Select **Add**, to add the backend settings.
282291

283292
1. In the *Add a routing rule* window, select **Add** again.
@@ -302,10 +311,29 @@ You can establish a secured connection to internal-only container app environmen
302311
| Private link subnet | Select the subnet you wish to create the private link with. |
303312
| Frontend IP Configuration | Select the frontend IP for your Application Gateway. |
304313

305-
1. Under **Private IP address settings** select **Add**.
314+
1. Under **Private IP address settings**, select **Add**.
306315

307316
1. Select **Add** at the bottom of the window.
308317

318+
## Preserve original host header for redirects and SSO
319+
320+
When Azure Application Gateway is configured as a reverse proxy and the *Override with new host name* setting is enabled, the `Host` header is modified. Modifying the header can interfere with applications that rely on the original host value to generate redirect URLs, absolute links, or support OpenID Connect (OIDC) authentication flows.
321+
322+
To forward the original host header, you can inject it into the `X-Forwarded-Host` header using Application Gateway's request header rewrite feature.
323+
324+
### Configure X-Forwarded-Host injection
325+
326+
To enable `X-Forwarded-Host` injection:
327+
328+
1. Under the **Configuration** tab, select **Backend settings** section of your Application Gateway routing rule:
329+
330+
- Enable **Request Header Rewrite**.
331+
- Add a new request header with the following values:
332+
- Header name: `X-Forwarded-Host`
333+
- Value: `{host}`
334+
335+
Your backend app can now read the original request host using the `X-Forwarded-Host` header.
336+
309337
## Verify the container app
310338

311339
# [Default domain](#tab/default-domain)

0 commit comments

Comments
 (0)