Choose Front Door, Application Gateway or Load Balancer
Pick the right ingress for a workload and trace edge-to-origin traffic, probes, TLS and WAF.
By Invicly Tech, , in Microsoft Azure Cloud Engineering. About 13 minutes to read.
In short
Azure offers several ways to bring users to your app. Front Door is a global layer 7 entry at Microsoft's edge, Application Gateway is a regional layer 7 load balancer inside your VNet, and Load Balancer is a regional layer 4 balancer for any TCP or UDP traffic. The right choice depends on whether users are global, whether you need HTTP features such as path routing and a WAF, and where TLS should end.
Explained simply
Ingress means the way traffic from users gets into your app. In Azure you rarely point users straight at one server. Instead you put a service in front that spreads requests across healthy servers, handles encryption and blocks bad traffic. Azure has three main choices: Front Door, Application Gateway and Load Balancer.
The first question is how much the front service needs to understand. Load Balancer works at layer 4: it sees IP addresses and ports, and simply passes connections on. Application Gateway and Front Door work at layer 7: they read the web request itself, so they can route by website name or URL path and run a web application firewall.
The second question is where your users are. Front Door runs at Microsoft's edge locations around the world, so users connect to a nearby point and Front Door carries the request to your app. Application Gateway and the standard Load Balancer live in one region, inside or next to your VNet.
Two more choices matter. Health probes are small checks the front service sends to each back end; only back ends that pass get traffic. TLS termination is where HTTPS is decrypted; you decide whether traffic is encrypted again on the way to your app.
Press Play on a diagram to walk through it one step at a time.
- Global, at Microsoft's edge
- Layer 7: HTTP and HTTPS only
- Caching, WAF, TLS at the edge
- Routes to the healthiest, fastest origin
- Regional, deployed in your VNet subnet
- Layer 7: path and host routing
- WAF_v2 SKU for a web firewall
- Reaches private back ends directly
- Regional (global tier exists)
- Layer 4: any TCP or UDP port
- No TLS termination or URL routing
- Very low latency, high throughput
- 1User
Resolves www.contoso.com to Front Door
- 2Front Door edge
TLS ends, WAF rules run, cache checked
- 3Origin group
Health probes pick a healthy region
- 4Origin
App Service or App Gateway, new TLS session
- 5App
Checks the X-Azure-FDID header
- Browser to Front Door edge: HTTPS to www.contoso.com1HTTPS to www.contoso.com
- Front Door edge to Application Gateway: After TLS, WAF and a cache miss: new HTTPS session2After TLS, WAF and a cache miss: new HTTPS session
- Application Gateway to App: Route /api to the API pool over HTTPS3Route /api to the API pool over HTTPS
- App to Application Gateway: 200 OK4200 OK
- Application Gateway to Front Door edge: Response5Response
- Front Door edge to Browser: Response, cached if allowed6Response, cached if allowed
In depth
Layer 4 and layer 7 in practice
Azure Load Balancer forwards TCP or UDP flows using a hash of the source and destination addresses and ports. It does not decrypt or read anything, which makes it fast and protocol-agnostic: databases, game servers, SMTP and custom TCP services all work. The Standard SKU is the one to use; the Basic SKU has been retired. A public load balancer has a public frontend IP; an internal one has a private frontend IP in your VNet.
Layer 7 balancers terminate the HTTP connection and open a new one to the back end. That lets them route /api to one pool and /images to another, rewrite headers, keep session affinity with a cookie, and apply WAF rules. The cost is more processing per request and HTTP-only scope.
- Load Balancer: any TCP or UDP port, no TLS, no paths
- Application Gateway: HTTP, HTTPS, WebSocket and HTTP/2, path and host rules
- Front Door: HTTP and HTTPS only, plus caching at the edge
- Traffic Manager: DNS-based global routing for any protocol
Global or regional entry
A regional entry sits in one Azure region. If that region fails, so does the entry. For a single-region app that is fine, and Application Gateway or Load Balancer is simpler and often cheaper.
A global entry has one name for the world. Front Door uses anycast, so users reach the nearest edge, where TLS is set up close to them; then traffic crosses Microsoft's backbone to the best origin. It fails over between regions based on health probes and latency. Traffic Manager is another global option, but it works only through DNS answers, so failover waits for DNS caches to expire, and it does not proxy traffic. Front Door and Application Gateway are often combined: Front Door at the edge for global routing and caching, Application Gateway in each region for private back ends.
- Non-HTTP traffic
- One region: Load Balancer
- Many regions: Load Balancer global tier or Traffic Manager
- HTTP, one region
- Application Gateway, WAF_v2 if public
- HTTP, many regions or global users
- Front Door
- Optionally Application Gateway behind it per region
- Containers on AKS
- Consider Application Gateway for Containers
Where TLS ends
Every layer 7 service must decrypt HTTPS to read the request, so it needs your certificate or a managed one. Front Door can issue and renew managed certificates for your custom domain; Application Gateway can pull certificates from Key Vault through a managed identity.
After termination you choose: send plain HTTP to the back end (TLS offload) or open a new HTTPS session (end-to-end TLS). Offload saves CPU on the back end but leaves traffic unencrypted inside the network. End-to-end TLS is the safer default and is required by many security standards. With Front Door to App Service, HTTPS to the origin is simple because App Service already has a valid certificate for its azurewebsites.net name. Load Balancer never terminates TLS; the back end must handle it.
- Front Door: managed certificates for custom domains
- Application Gateway: certificates from Key Vault
- Prefer end-to-end TLS unless you have a strong reason not to
- Back end certificate name must match the host the balancer sends
Health probes that tell the truth
A probe decides whether a back end gets traffic. Load Balancer probes check TCP, HTTP or HTTPS; Application Gateway sends HTTP or HTTPS requests to a path and expects a status code in a set range (200 to 399 by default); Front Door sends HEAD or GET requests from many edge locations at a set interval.
Design a dedicated endpoint such as /healthz that returns 200 quickly when the app can serve, without needing a login. Be careful with deep checks: if /healthz fails whenever the database is slow, every back end drops out at once and you cause a full outage. A good probe checks the app process and its own essentials, not every dependency. Also remember probes create traffic; Front Door's many edges can send a lot of HEAD requests to a small app.
Where the WAF sits and how to protect the origin
Put the WAF at the first layer 7 hop users reach. For a global app that is Front Door: the Premium tier adds Microsoft's managed rule sets and bot protection, while Standard supports custom rules only. For a regional app, use the Application Gateway WAF_v2 SKU. Start new policies in detection mode, read the logs for false positives, then switch to prevention.
A WAF only helps if attackers cannot go around it. Lock the origin so it accepts only traffic from your entry. For Front Door, allow the AzureFrontDoor.Backend service tag and check that the X-Azure-FDID header equals your profile's ID; the service tag alone admits every Front Door customer. Front Door Premium can also reach origins over Private Link, so the origin needs no public access at all.
- Global: WAF on Front Door; regional: Application Gateway WAF_v2
- Detection mode first, then prevention
- Origin lock: service tag plus X-Azure-FDID header
- Premium: Private Link origins and managed rule sets
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Compare layer 4 and layer 7~30m
- 2Compare global and regional entry~30m
- 3Place TLS termination~30m
- 4Configure health probes~30m
- 5Decide where the WAF sits~30m
Key points
- Layer 4 sees IPs and ports; layer 7 sees hosts, paths, headers and cookies.
- Global entry (Front Door) helps users in many regions and gives regional failover.
- Wherever TLS ends, decide whether to re-encrypt to the back end; for most apps, do.
- Health probes decide where traffic goes; a wrong probe path takes a healthy app out of rotation.
- Put the WAF at the first layer 7 hop: Front Door for global apps, Application Gateway for regional ones.
Key terms
Tap a card to flip it. 0/6 known
Examples
Choosing ingress for three workloads
Workload 1 is an internal SQL Server cluster in one region; clients use TCP 1433. It needs no HTTP features, so choose an internal Standard Load Balancer. Workload 2 is a public HR portal used only in one country, hosted on VMs in one region, with a security rule that requires a WAF. Choose Application Gateway with the WAF_v2 SKU in that region. Workload 3 is a public shop with customers on three continents, running in two regions, with static images. Choose Front Door Premium for edge TLS, caching, managed WAF rules and regional failover.
Locking an App Service origin to your Front Door
After putting Front Door in front of app-contoso, you find the azurewebsites.net address still answers directly, bypassing the WAF. Step 1: read the Front Door profile ID. Step 2: add an access restriction that allows only the AzureFrontDoor.Backend service tag with a matching X-Azure-FDID header. Evidence: a direct request to the azurewebsites.net URL returns 403, while requests through Front Door still return 200. Rollback: remove the rule by name.
FDID=$(az afd profile show -g rg-edge --profile-name fd-contoso \
--query frontDoorId -o tsv)
az webapp config access-restriction add -g rg-app -n app-contoso \
--rule-name from-front-door --priority 100 --action Allow \
--service-tag AzureFrontDoor.Backend --http-header x-azure-fdid=$FDID
curl -s -o /dev/null -w "%{http_code}\n" https://app-contoso.azurewebsites.net # 403
curl -s -o /dev/null -w "%{http_code}\n" https://www.contoso.com # 200Quick reference
- Load Balancer: layer 4, any TCP or UDP, regional (global tier for cross-region)
- Application Gateway: layer 7, regional, in its own subnet, WAF_v2 SKU for a WAF
- Front Door: layer 7, global edge, caching, Standard or Premium tier
- Traffic Manager: DNS-only global routing; failover waits for DNS TTLs
- Probe a fast /healthz that needs no login and checks only essentials
- Lock origins: AzureFrontDoor.Backend tag plus X-Azure-FDID header check
- Start WAF policies in detection mode, then switch to prevention
Common mistakes
- Using Load Balancer for a website that needs path routing or a WAF; it cannot read HTTP.
- Leaving the origin open to the internet so attackers can bypass Front Door and its WAF.
- Pointing the health probe at a page that needs login, so every back end looks unhealthy.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
For each case, name the ingress and one reason: a UDP voice service in one region; an internal HTTP API in one region with path routing; a public website with users worldwide.
- Exercise 2medium
Add a /healthz endpoint to a small web app and describe the probe settings you would give Application Gateway: path, interval, unhealthy threshold and accepted status codes.
- Exercise 3hard
Create a Front Door Standard profile with an App Service origin, then lock the origin to it and prove the lock. Cost: Front Door has a monthly base fee; delete the profile right after the test, or do a design-only run by writing the commands and expected results.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Can I use Front Door and Application Gateway together?
- Yes. A common pattern is Front Door at the edge for global routing and caching, with an Application Gateway in each region for private back ends. Decide which one runs the WAF so rules are not duplicated without reason.
- Is Azure Front Door a CDN?
- It includes CDN features such as edge caching and compression, and also acts as a global layer 7 load balancer with a WAF. Microsoft's newer CDN offerings are built on Front Door Standard and Premium.
- Why does Application Gateway need its own subnet?
- It runs as instances inside your VNet and scales out, so it needs a dedicated subnet with room for those instances. Nothing else can be placed in that subnet.
- What is the cheapest way to learn these without a big bill?
- Load Balancer Standard and a tiny VM pair cost little for an hour. Front Door and Application Gateway have base fees, so build, test and delete in one sitting, or do the design-only exercise with diagrams and expected results.