Azure Application Gateway
Azure Application Gateway Standard_v2 is the regional layer-7 ingress of the
ION hub. One gateway per environment, agw-rome-<env>-chn-02, lives in the hub
resource group rg-rome-<hubenv>-chn-01 in Switzerland North. It is the
priority-1 origin behind Azure Front Door and
the single hostname-and-path router in front of APIM and the SPA hosts. The
gateway:
- terminates TLS on the platform wildcard certificate, read from Key Vault;
- routes by hostname (
agw-<app>-webapp.<domain>,agw-api.<domain>) and by URL path to APIM, App Service, Static Web Apps, and storage backends; - rewrites request paths to APIM API paths, and adds security headers and CORS headers when traffic does not come through Front Door;
- scales on autoscale across three availability zones;
- carries the SignalR WebSocket leg and the manual Front Door outage bypass.
Why Application Gateway
Application Gateway is the regional layer of the edge topology decided in ADR-0015. The ADR rejected the alternatives for these reasons:
| Alternative | Why it was rejected |
|---|---|
| Front Door only (Option D) | Front Door is not the regional VNet boundary, and APIM and the SPA hosts would be coupled directly to the global edge. Front Door has no instance-level connection draining or affinity |
| Application Gateway only (Option C) | No global edge, no edge caching, no global health-based routing |
| Front Door directly to every backend (Option E) | Bypasses the shared routing layer and spreads public endpoints. Only the bounded exceptions in ADR-0015 are allowed |
| Self-hosted reverse proxy | Violates Azure-native managed services first (principle 21); ION would own patching, scaling, and recovery |
Front Door sends priority-1 traffic to Application Gateway. It routes by hostname and path to APIM and the SPA hosts.
ADR-0015Zones 1, 2, and 3 with autoscale. A Switzerland West warm spare is planned and not deployed.
ADR-0017The gateway lives in the hub and reaches backends over public PaaS endpoints, restricted by subnet service endpoints. Engineers use ZPA, and the platform runtime does not.
ADR-0016Each portal has an agw-<app>-webapp hostname that serves the SPA and rewrites its API prefixes to APIM.
ADR-0027Architecture principles
Application Gateway serves Front Door. Direct internet access is allowed only for the SignalR WebSocket hostnames and the outage bypass.
Every other listener is a Front Door origin. The NSG cannot tell listeners apart, so Front Door-only enforcement per listener needs the target-state WAF custom rule.
ExceptionsHostname, path, and header handling only. No identity, tenant, or business decisions.
APIM validates caller tokens, the BFF terminates user tokens, and domain services enforce rules. Rewrite rules never inject credentials.
ArchitectureEvery Front Door rewrite has a documented Application Gateway equivalent, so the outage bypass behaves like the normal path.
Security headers, CORS, and path rewrites are duplicated by design. The PR checklist checks parity, and the long-term goal is to generate both from one map.
GuidelinesNo cookie affinity, no stored data, and no session state in the gateway.
Application Gateway persists no request or response data. Real-time state lives in Azure SignalR and the backends.
Data protectionProbes hit real health paths on a short interval, and alerts fire before users notice.
Probe settings that are too slow delay the removal of a bad backend. Resource Health and metric alerts exist in every environment.
ResiliencyEvery listener, rule, and probe is Terraform, promoted alpha, beta, gamma, then prod, and tested by the hub test suite.
One shared gateway means one bad change reaches everything. Plan review and the post-deploy regression suite are the controls.
ImplementationReliability principles applied
The Microsoft Well-Architected reliability principles map to the Application Gateway design like this:
| Principle | How ION applies it |
|---|---|
| Design for business requirements | The 99.9% SLO and the per-scenario recovery objectives from ADR-0017 set the zone, capacity, and failover choices |
| Design for resilience | Three zones, autoscale with a minimum of two instances, short probe intervals, and Front Door priority-2 failover |
| Design for recovery | The gateway holds no data, so recovery is a redeploy from IaC. The Front Door outage bypass uses the gateway as the fallback path |
| Design for operations | Diagnostics through Azure Policy, metric and Resource Health alerts, a post-deploy regression suite, and promotion through four environments |
| Keep it simple | One gateway per environment, one wildcard certificate, one pattern per listener class. Legacy listeners are removed, not extended |
At a glance
| Aspect | Current configuration |
|---|---|
| Gateway | agw-rome-<env>-chn-02, SKU Standard_v2, HTTP/2 on, no WAF |
| Environments | mgtapa, mgtbta, mgtgma, mgtprd |
| Availability | Zones 1, 2, and 3. Autoscale minimum 2, maximum 10, hardcoded in the module |
| Frontend | Public static IP with DDoS protection. A private frontend IP exists and no listener uses it |
| Ports | 443 only. There is no HTTP listener |
| TLS | AppGwSslPolicy20220101S, wildcard certificate from Key Vault, HTTPS to every backend |
| Listeners | 16 hostname listeners and one host-less catch-all, one agw-* A record per hostname |
| Probes | 30 s interval, 30 s timeout, threshold 3, on every pool |
| Identity | The platform user-assigned managed identity reads the certificate from Key Vault |
| Diagnostics | Applied through Azure Policy to the Switzerland North Log Analytics workspace |
| Alerting | Resource Health alert in production only. No metric alerts |
Pages
| Page | Read it when |
|---|---|
| Architecture | You need the listener inventory, routing and priority model, rewrite model, or request flows |
| Resiliency | You are designing capacity, probes, change safety, alerts, or responding to a gateway failure |
| Security | You are changing the NSG, TLS, certificates, headers, CORS, or the exception paths |
| Guidelines | You need the MUST and SHOULD rules for a gateway change |
| Implementation | You are adding a listener or backend, running the regression suite, or closing a gap against the guidelines |