Azure Application Gateway is often used when an application needs HTTP and HTTPS routing, TLS termination, Web Application Firewall capabilities, host-based routing, path-based routing, and backend health monitoring.

The challenge appears when the application should remain completely private.

A common assumption is that making an Application Gateway private means giving up the Layer 7 features that make Application Gateway useful. That is not the case. You can design an Application Gateway with private frontend connectivity while still performing HTTP-aware routing between clients and backend applications.

The important part is understanding the difference between the frontend address, backend connectivity, DNS, routing, and security controls.

A private Application Gateway is not simply an Application Gateway with a public IP removed. The surrounding network architecture must also be designed so that clients can resolve, reach, and securely communicate with the private frontend.

This article explains how to keep an Azure Application Gateway private while retaining Layer 7 routing, how the traffic path works, and what to check when private application access does not behave as expected.

What Is Azure Application Gateway?

Azure Application Gateway is a Layer 7 application delivery service.

Layer 7 means that the gateway understands application protocols such as HTTP and HTTPS rather than treating traffic only as raw IP packets.

For example, a network-level load balancer may primarily make decisions using information such as:

Code
Source IP
Destination IP
Protocol
Port

Application Gateway can make routing decisions using HTTP information such as:

Code
Host name
URL path
HTTP headers
TLS configuration
Backend health

That allows a single gateway to route traffic to different applications.

For example:

Code
Client
   |
   v
Application Gateway
   |
   +---- api.example.com      → API backend
   |
   +---- portal.example.com  → Portal backend
   |
   +---- reports.example.com → Reports backend

This Layer 7 capability remains useful even when the gateway itself is private.

What Does a Private Application Gateway Mean?

A private Application Gateway uses a private frontend IP address rather than exposing the application entry point through the public internet.

A simplified architecture looks like this:

Code
Private Client
      |
      v
Private DNS
      |
      v
Private IP
      |
      v
Application Gateway
      |
      v
Backend Application

The client needs private network connectivity to the subnet where the gateway's frontend is available.

That connectivity could come from:

  • The same Azure VNet

  • VNet peering

  • VPN

  • ExpressRoute

  • Another approved private connectivity architecture

The key point is that the client reaches the gateway through private networking.

Private Frontend Does Not Remove Layer 7 Routing

This is the most important concept.

The frontend being private and the routing logic being Layer 7 are separate concerns.

For example:

Code
Private client
      |
      | HTTPS
      v
Private Application Gateway
      |
      +---- Host: api.internal.example.com
      |             |
      |             v
      |          API backend
      |
      +---- Host: portal.internal.example.com
                    |
                    v
                 Portal backend

The gateway can still inspect the HTTP request and select the appropriate backend.

The fact that the client reached the gateway through a private IP does not prevent Layer 7 routing.

Why Use a Private Application Gateway?

Private Application Gateway is useful when applications should be reachable only from trusted networks.

Typical examples include:

  • Internal enterprise applications

  • Private APIs

  • Administrative portals

  • Internal dashboards

  • Back-office systems

  • Applications used by corporate users

  • Internal Kubernetes applications

  • Private microservices

  • Applications exposed through private connectivity to another VNet

The architecture avoids making the application publicly reachable simply because it needs HTTP routing.

For example:

Code
Internet
   |
   X
   |
Private Application Gateway
   |
   v
Internal Application

Instead:

Code
Corporate Network
       |
       v
Private Connectivity
       |
       v
Application Gateway
       |
       v
Internal Application

Frontend and Backend Are Different

One of the easiest ways to understand Application Gateway is to separate its frontend from its backend.

The frontend is where clients connect.

The backend is where Application Gateway sends traffic after making its routing decision.

For example:

Code
Client
   |
   | HTTPS
   v
Frontend IP
   |
   v
Application Gateway
   |
   | HTTP/HTTPS
   v
Backend pool
   |
   v
Application

Making the frontend private does not mean that the backend must use the same network address.

The gateway can have private connectivity to backend resources while presenting a private frontend to clients.

This separation allows the gateway to act as a controlled application entry point.

The Network Placement Matters

Application Gateway is deployed into an Azure subnet.

That subnet becomes an important part of the architecture.

A simplified VNet might look like:

Code
Azure VNet
|
+-- Application Gateway Subnet
|       |
|       +-- Private Application Gateway
|
+-- Application Subnet
|       |
|       +-- Backend Application
|
+-- Private DNS / supporting services

The exact subnet structure depends on the environment and Azure requirements.

The important design principle is to keep the gateway and application networking organized so that routing and security rules are easy to understand.

Do not treat the Application Gateway subnet like an ordinary application subnet.

Private DNS Is Essential

Suppose the application is available at:

Code
portal.internal.example.com

A client must resolve this hostname to the private Application Gateway frontend.

The expected flow is:

Code
portal.internal.example.com
          |
          v
Private DNS
          |
          v
10.20.10.20
          |
          v
Application Gateway

If DNS instead returns a public IP, the client may attempt to access the application through the internet path.

If DNS returns the wrong private IP, the client may reach another environment.

If DNS cannot resolve the name, the client may fail before any Azure Application Gateway troubleshooting begins.

For this reason, private DNS should be considered part of the application architecture, not an afterthought.

Split-Horizon DNS

Organizations often want the same hostname to work differently depending on where the client is located.

For example:

Code
Internal client
      |
      v
portal.example.com
      |
      v
Private IP

An external client might receive:

Code
portal.example.com
      |
      v
Public IP

This approach is useful when an application has both internal and external access requirements.

However, if the application is intended to be completely private, avoid maintaining an unnecessary public endpoint simply because the DNS name is shared.

The important question is:

"Which networks should be able to resolve and reach this application?"

That answer should drive the DNS architecture.

Host-Based Routing With a Private Gateway

One of the biggest benefits of keeping Application Gateway private is that you do not lose host-based routing.

Imagine an enterprise environment with:

Code
hr.internal.example.com
finance.internal.example.com
inventory.internal.example.com

All three names can resolve to the same private Application Gateway frontend.

The gateway then routes requests based on the Host header.

Conceptually:

Code
Private Application Gateway
        |
        +-- hr.internal.example.com
        |       |
        |       v
        |    HR Application
        |
        +-- finance.internal.example.com
        |       |
        |       v
        |    Finance Application
        |
        +-- inventory.internal.example.com
                |
                v
             Inventory

This provides centralized application routing without exposing the gateway publicly.

Path-Based Routing

Private Application Gateway can also route requests based on URL paths.

For example:

Code
internal.example.com/orders
internal.example.com/customers
internal.example.com/reports

The gateway can direct each path to an appropriate backend.

A simplified routing structure is:

Code
internal.example.com
        |
        +-- /orders
        |       |
        |       v
        |    Orders API
        |
        +-- /customers
        |       |
        |       v
        |    Customer API
        |
        +-- /reports
                |
                v
             Reports API

This can be useful when several internal services share a common application hostname.

However, path-based routing can require additional application configuration.

Check how the backend handles:

  • URL prefixes

  • Redirects

  • Absolute URLs

  • Static content

  • Cookies

  • API documentation

  • Authentication callbacks

TLS Termination

Application Gateway can terminate HTTPS connections before forwarding traffic to the backend.

The architecture might look like:

Code
Client
   |
HTTPS
   |
Private Application Gateway
   |
HTTP
   |
Backend

Or HTTPS can continue to the backend:

Code
Client
   |
HTTPS
   |
Private Application Gateway
   |
HTTPS
   |
Backend

The second approach provides encryption between the gateway and backend as well.

Which model is appropriate depends on the security requirements.

For sensitive internal applications, encrypting traffic beyond the gateway may be desirable even though both systems are inside the same VNet.

Certificate Management

When Application Gateway handles HTTPS, certificate management becomes part of the architecture.

The gateway needs to present a certificate that matches the hostname used by clients.

For example:

Code
Client requests:

finance.internal.example.com

Certificate must cover:

finance.internal.example.com

If the certificate does not match, clients may report TLS errors even though network connectivity is working.

When troubleshooting HTTPS, separate the problem into:

Code
DNS
  ↓
Network connectivity
  ↓
TCP connection
  ↓
TLS handshake
  ↓
HTTP routing
  ↓
Backend response

This layered approach prevents certificate problems from being confused with routing problems.

Backend Pools

Application Gateway sends requests to backend pools.

A backend pool might contain:

  • Virtual machines

  • Virtual machine scale sets

  • Private IP addresses

  • App Service resources

  • Kubernetes-related endpoints

  • Other supported backend targets

The gateway does not simply forward traffic to anything that responds.

It uses its configured backend settings and health probes to determine whether a backend is available.

For example:

Code
Application Gateway
       |
       v
Backend Pool
   |
   +-- Server 1 → Healthy
   |
   +-- Server 2 → Healthy
   |
   +-- Server 3 → Unhealthy

Traffic can then be routed according to the gateway configuration.

Health Probes Matter

A private Application Gateway can have a healthy frontend but unhealthy backends.

This creates a common troubleshooting situation:

Code
Client
   |
   v
Private IP
   |
   v
Gateway responds
   |
   X
Backend unavailable

The client may receive errors such as 502 or another gateway-level response.

When this happens, check the backend health rather than immediately changing DNS or network rules.

Verify:

  • Probe protocol

  • Probe hostname

  • Probe path

  • Probe port

  • Expected status code

  • Backend listener

  • Backend network connectivity

The health probe should test something that represents actual application readiness.

Host Headers Can Cause Problems

Some backend applications expect a specific Host header.

For example, the gateway may receive:

Code
Host: portal.internal.example.com

but the backend application may expect:

Code
Host: backend.internal.local

If the gateway's backend settings do not handle this correctly, the backend may return an error even though the network connection works.

This is particularly important with:

  • Web servers

  • Multi-tenant applications

  • Frameworks that validate hostnames

  • Applications using virtual hosts

  • Authentication systems

Always test the complete HTTP request path rather than only testing whether the backend IP is reachable.

Private Application Gateway and AKS

Application Gateway is often used in front of Azure Kubernetes Service applications.

A simplified architecture is:

Code
Private Client
      |
      v
Private Application Gateway
      |
      v
AKS Ingress
      |
      v
Kubernetes Service
      |
      v
Pods

The gateway provides the Azure-side application entry point.

The Kubernetes ingress layer handles application routing inside the cluster.

This can be useful when an organization wants Azure-native traffic management while keeping the Kubernetes workloads private.

However, it introduces another layer that must be monitored.

A request can fail at:

Code
Client
  ↓
DNS
  ↓
Application Gateway
  ↓
Ingress
  ↓
Service
  ↓
Pod

Troubleshooting should follow the same order.

Private Access From Another VNet

Suppose Application Gateway is deployed in VNet A and the client application is deployed in VNet B.

The architecture may look like:

Code
VNet A
|
+-- Private Application Gateway
|
|
+--------- VNet Peering ---------
|
|
VNet B
|
+-- Client Application

The client needs:

  • DNS resolution

  • Route to the private frontend

  • Network security permission

  • Return route

  • Correct port access

VNet peering by itself does not guarantee that every traffic path is valid.

Always test the actual route.

Private Access From On-Premises

Enterprise environments may also expose the private gateway to on-premises clients.

For example:

Code
Corporate Network
       |
       v
ExpressRoute / VPN
       |
       v
Azure VNet
       |
       v
Private Application Gateway
       |
       v
Application

The private gateway can therefore serve as an internal application entry point for employees and corporate systems.

The network team must ensure that the private IP range is advertised or routed correctly to the corporate environment.

DNS must also return the private address to those clients.

Network Security Rules

Private Application Gateway should not be treated as automatically trusted simply because it has a private IP.

Restrict network access to the gateway based on the actual client requirements.

For example:

Code
Corporate subnet
      |
      | TCP 443
      v
Application Gateway

may be allowed.

But:

Code
Every VNet
      |
      | TCP 443
      v
Application Gateway

may be unnecessarily broad.

Review:

  • Source networks

  • Destination subnet

  • Destination port

  • Required protocols

  • Network security groups

  • Azure Firewall policies

  • Route tables

Network security should reinforce the application's intended access model.

Web Application Firewall

A private Application Gateway can still be useful when Web Application Firewall capabilities are required.

The security architecture can therefore be:

Code
Private Client
      |
      v
Private Application Gateway + WAF
      |
      v
Backend Application

The application does not need to be public simply because WAF functionality is required.

This can be useful for internal applications that still need protection against application-layer attacks.

However, WAF rules should be tested against the application's actual behavior.

Internal applications can still generate false positives when they use:

  • Complex JSON

  • File uploads

  • Special URL parameters

  • Unusual headers

  • Custom API formats

Troubleshooting Private Application Gateway

Use a layered approach.

Step 1: Verify DNS

Confirm the hostname resolves to the expected private frontend IP.

Code
nslookup app.internal.example.com

Step 2: Verify Network Connectivity

Confirm that the client can reach the private IP over the expected port.

Check:

  • VNet connectivity

  • VNet peering

  • VPN

  • ExpressRoute

  • Network security groups

  • Azure Firewall

  • Route tables

Step 3: Check Gateway Listener

Verify:

  • Frontend IP

  • Frontend port

  • HTTPS configuration

  • Certificate

  • Hostname

  • Listener state

Step 4: Check Routing Rules

Verify that the incoming hostname or path matches the expected rule.

For example:

Code
api.internal.example.com
        |
        v
API backend

portal.internal.example.com
        |
        v
Portal backend

Step 5: Check Backend Health

If the gateway is reachable but requests fail, check backend health.

Step 6: Check Backend Connectivity

Confirm that the gateway can reach the backend on the configured port.

Step 7: Check Application Logs

Only after the network and gateway layers are verified should you move deeper into application debugging.

This avoids wasting time investigating application code when the actual failure is a route or listener configuration.

Common Mistakes

Removing the Public IP but Forgetting DNS

Clients may still attempt to use the old public address.

Treating Private as Automatically Secure

A private IP reduces exposure but does not replace authorization or network controls.

Ignoring Backend Health

A healthy gateway does not mean the application behind it is healthy.

Incorrect Hostname Configuration

A listener, certificate, routing rule, or backend may expect a different hostname.

Incorrect TLS Configuration

The certificate may not match the hostname requested by the client.

Forgetting Return Routing

The client may reach the gateway while the response path fails.

Making the Gateway Subnet Too Open

Private infrastructure should still have controlled access.

Testing Only From One Network

An application that works from the same VNet may fail from an on-premises network or another peered VNet.

Production Checklist

Before keeping an Azure Application Gateway private, verify:

  • Private frontend architecture is defined.

  • Gateway subnet is correctly configured.

  • Private IP address is assigned as expected.

  • Private DNS is configured.

  • Required clients resolve the correct private hostname.

  • VNet routing is configured.

  • VNet peering is validated where required.

  • VPN or ExpressRoute routing is validated where required.

  • Network security rules are reviewed.

  • HTTPS listeners are configured.

  • Certificates match the application hostnames.

  • Backend pools are configured correctly.

  • Backend health probes are working.

  • Host-based routing is tested.

  • Path-based routing is tested where applicable.

  • Backend Host header behavior is verified.

  • TLS termination is documented.

  • Backend encryption requirements are documented.

  • WAF rules are tested if WAF is enabled.

  • Application authentication remains enabled.

  • Gateway logs are available.

  • Backend application logs are available.

  • Failure scenarios are tested.

  • No unnecessary public endpoint remains.

Advantages and Disadvantages

Advantages

A private Application Gateway provides:

  • Private application entry points

  • Layer 7 routing

  • Host-based routing

  • Path-based routing

  • HTTPS termination

  • Backend health monitoring

  • Centralized application traffic management

  • Integration with private Azure networking

  • Optional WAF protection

Disadvantages

The architecture also introduces additional operational requirements:

  • Private DNS must be maintained.

  • Routing becomes more complex.

  • Gateway and backend health must be monitored separately.

  • TLS certificates require management.

  • Cross-VNet and on-premises connectivity needs explicit configuration.

  • Troubleshooting spans multiple network layers.

The additional complexity is reasonable when the application needs Layer 7 routing but should not be publicly exposed.

Summary

Keeping Azure Application Gateway private does not mean giving up Layer 7 routing.

The gateway can continue to make decisions based on hostnames, URL paths, HTTPS configuration, backend health, and other application-level information while clients reach it through private network connectivity.

The key is to design the complete path:

Code
Client
   ↓
Private DNS
   ↓
Private IP
   ↓
Application Gateway
   ↓
Backend routing
   ↓
Application

DNS determines where the client connects. Azure networking determines whether that private address is reachable. Application Gateway handles Layer 7 routing and backend selection. Network security controls determine which clients are permitted to connect.

When these layers are configured together, internal applications can retain the benefits of Application Gateway without requiring a public frontend.

The most important operational practice is to troubleshoot the architecture from the outside in. Check DNS first, then routing, then the gateway listener and routing rules, then backend health, and finally the application. This makes private Application Gateway deployments much easier to operate and diagnose in production.