Application Gateway Can Finally Hide Its Server Header on Error Pages Too

Header rewrite rules never reached the 4xx and 5xx responses the gateway generates itself. A new gateway-wide flag does, and it's still only one small layer.

Application Gateway Can Finally Hide Its Server Header on Error Pages Too

Published .

Until now, your Application Gateway has introduced itself to every scanner that asked, and you couldn’t make it stop. Every response carried Server: Microsoft-Azure-Application-Gateway/v2. You could paper over the normal responses with a header rewrite rule. The error pages (the 4xx and 5xx the gateway generates itself) kept leaking, because rewrites don’t touch gateway-generated responses. That gap is exactly what shows up in a pen-test report three weeks after you thought you’d fixed it.

Microsoft now ships a gateway-wide setting that turns off the self-identification on both normal and error responses. It’s documented on Microsoft Learn as “Application Gateway server information,” last updated 2 December 2026. The announcement is described as GA. I’ll take that at face value, with one caveat: the Azure update page (id 582734) rendered as “0 Updates found” when I fetched it, so I won’t quote a GA date, a SKU list or a region list I can’t see. The header string says v2. Treat v1 as unconfirmed.

So it’s a three-horse race: the old rewrite rule, the new global flag, and the front proxy you’d stand up if neither existed. Here’s how they place on the criteria that matter.

Three options

The rewrite rule can't reach error pages; the flag and a proxy can

Judged on whether each option covers gateway-generated 4xx/5xx, and at what cost. The front-proxy column is author analysis.

Header rewrite rule New global flag Front proxy
Covers gateway-generated 4xx/5xx ✕ ✓ Depends on proxy config
SKU v2 only Unconfirmed (header says v2) Any
Scope Per listener/rule Whole gateway Everything behind it
Ongoing effort Rules to maintain One property A box to patch
In plain words: The old trick missed the error pages. The new switch covers them with one setting.

Source: Microsoft Learn (rewrite article, global configuration); front-proxy column is author analysis

On the error-page gap, the round that decides this, the rewrite rule loses outright. Learn’s rewrite article is explicit: rewrites aren’t supported for 4xx and 5xx responses generated directly by Application Gateway, nor when it redirects or serves a custom error page. A Microsoft Q&A answer from July 2025 said there was no built-in way to strip the header from those responses. The new flag closes that gap. On scope and effort it’s also cleaner: one property, whole gateway, no per-listener rules to maintain. A front proxy can cover everything too, but you’re now running and patching another box to hide one string. That’s not hardening, that’s a hobby.

Verify it yourself before and after. Hit a normal listener first and watch the Server line. The error path is trickier to script, so read the comments.

run.shbash, zsh
# Before: a normal response announces the gateway
curl -sI https://app.contoso.com/ | grep -i '^server:'
# server: Microsoft-Azure-Application-Gateway/v2
​
# To test the error path you need a request the gateway answers ITSELF
# (a 4xx/5xx it generates, not one the backend returns). Which request does
# that depends on your listeners, WAF rules and custom error pages. I haven't
# pinned a reliable trigger on a live gateway, so find yours and record it.
​
# After the setting is applied, the same check should print nothing
# (expected result, not something I observed):
curl -sI https://app.contoso.com/ | grep -i '^server:' || echo "no Server header"
​
# Then repeat with whichever request produced a gateway-generated error before.

Configuration is portal, PowerShell or REST. Learn shows no CLI example, and azure-cli issue #34127 for first-class support was still in Backlog when I checked. Portal path: the gateway resource > Settings > Configuration > set “Application Gateway server information” to False > Save. PowerShell is the documented route:

audit.ps1PowerShell
$appgw = Get-AzApplicationGateway -Name "appgw-prod" -ResourceGroupName "rg-edge"
$appgw.DisableDefaultServerHeaderInResponse = $true
Set-AzApplicationGateway -ApplicationGateway $appgw -WhatIf

One honest caveat on that -WhatIf: I haven’t confirmed that Set-AzApplicationGateway supports it, and even where -WhatIf exists it only previews the call, with no property diff. For a real before/after, use Bicep what-if, or diff az network application-gateway show around the change. In Bicep the property is disableDefaultServerHeaderInResponse, sitting next to enableRequestBuffering and enableResponseBuffering in globalConfiguration. The template reference shows it on 2026-03-01 (2026-05-01 is listed as latest), though the REST create-or-update reference I fetched showed only the two buffering properties. That may be doc lag, so let what-if settle it. This snippet is my own, not from Learn. Carry the buffering flags through so the PUT doesn’t quietly reset them. That reset is my inference, not documented behaviour:

snippet.txtBICEP
// Author's own sample. Pinned to an API version the template reference
// shows carrying the property. Confirm with what-if before you apply.
param location string = resourceGroup().location
param enableRequestBuffering bool   // set to your gateway's CURRENT value
param enableResponseBuffering bool  // set to your gateway's CURRENT value
​
resource appgw 'Microsoft.Network/applicationGateways@2026-03-01' = {
  name: 'appgw-prod'
  location: location
  properties: {
    globalConfiguration: {
      disableDefaultServerHeaderInResponse: true
      enableRequestBuffering: enableRequestBuffering
      enableResponseBuffering: enableResponseBuffering
    }
    // ...rest of the gateway config
  }
}
run.shbash, zsh
az deployment group what-if \
  --resource-group rg-edge \
  --template-file appgw.bicep

Blast radius is small but non-zero. Nothing in the Server header should matter to your health probes, so I’d expect them to be unaffected. Confirm that on a test gateway rather than taking my word. What probably breaks is dashboards or synthetic tests that grep for the header to prove “traffic is going through the gateway.” If you have that check, it’ll go red on a change that improved your posture. Fix the check. On disruption, Learn says only to consider the impact on traffic, service availability and billing before changing global settings. It doesn’t say whether the flag triggers a gateway update, so treat it like any global-config change and roll it out off-peak until you’ve watched one go through.

Policy angle, since someone will ask: there is no built-in Azure Policy for this. The networking built-in list has six Application Gateway definitions (WAF deployed, TLS 1.2+, resource logs, and the rest), and none touches the server header or globalConfiguration. A custom policy on the property alias is plausible, but check that the alias exists (az provider show --namespace Microsoft.Network --expand "resourceTypes/aliases") before you promise anyone enforcement.

Now the limits. The flag is gateway-wide, so you can’t scope it per listener. It doesn’t cover Application Gateway for Containers, which is a separate resource type, or Front Door, or your backend’s own headers. I found no confirmed equivalent for any of them. And hiding the header does not hide the gateway. I haven’t pointed a scanner at a hardened gateway to prove that, and Microsoft doesn’t document it either. It’s general fingerprinting knowledge: TLS version and cipher ordering, header casing and order, response timing, the shape of the default error body, and the Azure public IP ranges can all still give the game away. You took the brand plate off the security door. The lock shape and the sound it makes when it shuts are unchanged.

Where it sits

Hiding the header is the bottom rung, not the climb

Hiding information is real but weak. The controls that stop attacks sit above it.

Private networking / isolationRung 4

Shrinks the public attack surface where you can.

WAF rulesRung 3

Inspects requests and blocks malicious ones.

TLS policy + patchingRung 2

Limits weak protocols and ciphers. Patching your backends closes known flaws.

Hide the Server headerRung 1

Reduces casual disclosure. Fingerprinting can survive through TLS behaviour, timing and other signals.

▼ weakerstronger ▲
In plain words: Hiding the name helps a little. The strong protections are higher up the ladder.

Source: Author's ranking; scope note from the research dossier

The decision rule: if a pen-test or compliance baseline flagged server-version disclosure on your edge, turn the flag on. It’s the first option that reaches the error pages, and the change is easy to audit. If you were hoping it hides the gateway, don’t bother. Spend the hour on TLS policy, WAF rules and network isolation. Pick the front proxy only when you need to rewrite far more than one header and already run that tier for other reasons. Whichever you choose, run the error-page check on your own gateway and keep the output for the auditor.