📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Nginx, IIS, YARP, Azure Front Door, Application Gateway and API Management can all sit in front of a .NET API. What does each one actually do, at which layer and scope, and how would you decide which ones a given system needs?

Compares Nginx, IIS with the ASP.NET Core Module, YARP, Azure Front Door, Application Gateway (and Application Gateway for Containers), Azure Load Balancer and API Management by layer, scope and job, and how to choose a minimal layered edge for a .NET API in Azure.

Mid-Level Theory Intermediate api-management application-gateway azure-front-door devops reverse-proxy yarp

🎯 Key points

  • Front Door: global L7 anycast edge with WAF, CDN caching and multi-region failover
  • Application Gateway: regional L7 load balancer in a VNet with WAF v2 and path routing
  • Front Door + Application Gateway together only when a private regional L7 hop adds something (VNet-only backends, per-region rules)
  • Azure Load Balancer is L4 (TCP/UDP) only; Traffic Manager is DNS-based
  • API Management: API product layer (keys, quotas, policies, portal), not a general load balancer
  • Nginx and IIS: self-hosted proxies on VMs; IIS hosts ASP.NET Core via the ASP.NET Core Module
  • Kubernetes ingress-nginx: retirement announced by SIG Network in Nov 2025, no releases or security fixes after March 2026; use Gateway API
  • One component per job; for in-country processing requirements prefer a regional edge in Australia East / Southeast

⏱ 30-second answer

They overlap, but each has a home. Azure Front Door is a global layer-7 edge: anycast entry points, WAF, CDN caching and failover between regions. Application Gateway is a regional layer-7 load balancer inside your VNet with WAF v2 and path routing; Application Gateway for Containers is its AKS flavour. API Management is an API product layer: subscription keys, quotas, policies, versioning and a developer portal. Nginx and IIS are self-hosted proxies on VMs (IIS hosts ASP.NET Core through the ASP.NET Core Module). YARP is a proxy library you run as a .NET app when routing needs C# logic.

I decide by job: global edge and WAF, regional private routing, API productisation, custom routing. One component per job. The trade-off is that every extra layer adds latency, cost and another set of timeouts to keep in step.

🗣 Full answer (senior)

How I would answer this in an interview

"I sort these by layer and scope. Front Door is global: users hit the nearest Microsoft edge point of presence over anycast, it terminates TLS, runs WAF rules, can cache static content, and routes to origins in one or more regions, so it gives me failover between Australia East and Australia Southeast. Application Gateway is regional and lives in my VNet: it's a layer-7 load balancer with path-based routing, WAF v2 and private backends, and in AKS the newer Application Gateway for Containers plays the ingress role. Azure Load Balancer is layer 4 only, so it knows TCP ports, not URLs.

API Management is a different kind of thing. It's about treating APIs as products: subscription keys, quotas, JWT validation policies, transformation, versioning and a developer portal. It can route, but I don't use it as my load balancer. Nginx and IIS are what you run yourself on VMs; IIS is still common in Australian enterprise and government for Windows hosting, and it runs ASP.NET Core through the ASP.NET Core Module, in-process by default. YARP is a library: I build a .NET app that is a proxy, which is great when routing needs real logic in C#. On Kubernetes the community ingress-nginx controller was retired in March 2026, so new clusters should use a Gateway API implementation instead.

The mistake I see is stacking everything: Front Door, then Application Gateway, then API Management, then an Nginx ingress, then YARP, each terminating TLS and each with its own timeout. That's five hops to debug. For a typical public API I'd pick Front Door with WAF straight to Container Apps, add API Management only if partners consume the API, and add YARP only if routing needs code. Fewer layers, each with a clear job."


Who does what

Component Layer Scope Main job Hosting
Azure Front Door L7 Global Edge TLS, WAF, CDN, multi-region failover Managed
Application Gateway L7 Regional, in VNet Private L7 load balancing, WAF v2, path routing Managed
App Gateway for Containers L7 Regional, AKS Kubernetes ingress / Gateway API Managed
Azure Load Balancer L4 Regional TCP/UDP distribution Managed
Traffic Manager DNS Global DNS-based failover Managed
API Management L7 Regional or multi-region API products, keys, quotas, policies, portal Managed
Nginx L7 Wherever you run it Proxy, TLS, routing, caching Self-hosted
IIS + ASP.NET Core Module L7 Windows server Host and proxy ASP.NET Core on Windows Self-hosted
YARP L7 Wherever you run it Custom routing logic in C# Self-hosted .NET app

Typical combinations

System Edge layout
Public SaaS API on Container Apps Front Door (WAF) → Container Apps ingress
Partner API products Front Door → API Management → services
Private line-of-business app Application Gateway (WAF v2) in VNet → App Service with private endpoint
AKS microservices Front Door → Gateway API implementation → services
Legacy Windows estate IIS on VMs behind Application Gateway

Production example

A public API had Front Door → Application Gateway → API Management → Nginx ingress → services, with TLS terminated four times and p50 overhead of about [35 ms] before the app ran. Removing Application Gateway (Front Door already had WAF) and the Nginx ingress (Container Apps ingress replaced it) cut edge overhead to about [12 ms] and halved the number of certificates to renew.

🔍 What the interviewer is checking

Checks that the candidate can place each proxy and gateway by layer and scope and can design a minimal edge instead of stacking products.

Green flags

  • Distinguishes global (Front Door) from regional (Application Gateway) and L7 from L4
  • Explains API Management as an API product layer, not a load balancer
  • Knows how IIS hosts ASP.NET Core and where YARP fits
  • Mentions locking the origin to the edge and the ingress-nginx retirement

Red flags

  • "Use all of them for defence in depth" with no cost or latency thinking
  • Thinks Azure Load Balancer routes by URL
  • Cannot say which component terminates TLS

📚 Learn in depth

1. Layers and scope

            DNS (Traffic Manager)                  ← picks an endpoint by DNS answer
                    │
User ──▶ Front Door POP (global anycast, L7)       ← TLS, WAF, cache, origin failover
                    │  private link or public origin
           Application Gateway (regional, L7)       ← VNet, WAF v2, path routing
                    │
           API Management (API layer)               ← keys, quotas, policies
                    │
           Ingress / YARP / Nginx                   ← in-cluster or in-app routing
                    │
                 Kestrel

You rarely need every row. Each row is optional; choose rows by the jobs you need done.

2. Global vs regional

Front Door's anycast IPs are announced from Microsoft points of presence worldwide, including Sydney and Melbourne. TLS is terminated close to the user, then traffic rides Microsoft's backbone to the origin. Because it is global, it can route away from a failed region. Application Gateway is deployed into a subnet in one region; for Australia East and Southeast resilience you run one per region and put Front Door or Traffic Manager in front.

3. API Management is not a load balancer

API Management executes a policy pipeline per call (inbound, backend, outbound, on-error), written in XML policies with C# expressions. It is built for API governance: products, subscriptions, rate limits per key, JWT validation, transformation, mocking and analytics. It can load balance across backend pools, but it does not replace WAF or global failover, and its per-call overhead is higher than a plain proxy.

4. IIS and the ASP.NET Core Module

On Windows, IIS runs ASP.NET Core through the ASP.NET Core Module (ANCM). In-process (default since 3.0): the app runs inside w3wp.exe using IISHttpServer, no Kestrel hop. Out-of-process: IIS proxies to a Kestrel process. Limits come from IIS (maxAllowedContentLength, 30,000,000 bytes by default) as well as the app.

5. Kubernetes ingress in 2026

The community ingress-nginx controller stopped receiving releases and security fixes in March 2026. New AKS clusters should use a Gateway API implementation (Application Gateway for Containers, Istio, Envoy Gateway and others). Annotations from ingress-nginx do not carry over; they must be expressed as HTTPRoute rules and policies.

6. YARP's niche

YARP is a toolkit, not a product: no portal, no WAF, no managed scaling. It wins where routing needs code (tenant-aware routing, strangler-fig migration, BFF token handling) and where a .NET team wants to debug the proxy with the same tools as the app.

Try it yourself

  1. Draw your current system's edge and list which component terminates TLS, runs WAF, and routes by path. Look for duplicates.
  2. Use Application Insights or Front Door logs (AzureDiagnostics / FrontDoorAccessLog) to measure time spent before the request reaches the app.
  3. Deploy a Container App behind Front Door with Private Link and confirm the app is not reachable directly.
  4. Write one HTTPRoute that replaces an ingress-nginx rewrite annotation.

💻 Code

Locking the app to one edge: accept traffic only from your Front Door profile and trust its forwarded headers.

// Program.cs (.NET 10)
using Microsoft.AspNetCore.HttpOverrides;

var builder = WebApplication.CreateBuilder(args);
var frontDoorId = builder.Configuration["Edge:FrontDoorId"]
    ?? throw new InvalidOperationException("Edge:FrontDoorId is required");

builder.Services.Configure<ForwardedHeadersOptions>(o =>
{
    o.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
    // Container Apps ingress is the immediate hop; trust its range from config.
    foreach (var cidr in builder.Configuration.GetSection("Edge:TrustedNetworks").Get<string[]>() ?? [])
        o.KnownIPNetworks.Add(System.Net.IPNetwork.Parse(cidr));
});

var app = builder.Build();
app.UseForwardedHeaders();

// Reject anything that did not come through *our* Front Door profile.
app.Use(async (ctx, next) =>
{
    if (ctx.Request.Headers["X-Azure-FDID"] != frontDoorId)
    {
        ctx.Response.StatusCode = StatusCodes.Status403Forbidden;
        return;
    }
    await next(ctx);
});

app.MapGet("/health/ready", () => Results.Ok());
app.Run();

A Gateway API route replacing an ingress-nginx rule in AKS:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: orders
spec:
  parentRefs:
    - name: public-gateway
  hostnames: ["api.example.com"]
  rules:
    - matches:
        - path: { type: PathPrefix, value: /orders }
      backendRefs:
        - name: orders-api
          port: 8080

⚠ Common mistakes

  • Mistake: Using API Management as the load balancer and WAF. Why it is wrong: It is an API governance layer with higher per-call cost and no WAF of its own. Instead: Put Front Door or Application Gateway WAF in front and use API Management for products and policies.
  • Mistake: Stacking Front Door, Application Gateway and an ingress that all terminate TLS and run WAF. Why it is wrong: Triple cost, extra latency and three places to debug timeouts. Instead: One component per job. Where Front Door and Application Gateway are combined, give them distinct jobs: Front Door for global entry, DDoS absorption and failover between Australia East and Southeast; Application Gateway for private, VNet-only routing to backends that must not have public endpoints, with WAF in one place only.
  • Mistake: Treating Azure Load Balancer as an HTTP router. Why it is wrong: It is layer 4 and cannot route by path or host. Instead: Use Application Gateway or Front Door for HTTP rules.
  • Mistake: Leaving the origin publicly reachable behind Front Door. Why it is wrong: Attackers bypass the WAF by calling the origin directly. Instead: Use Private Link origins or check the X-Azure-FDID header plus the AzureFrontDoor.Backend service tag.
  • Mistake: Starting new AKS clusters on community ingress-nginx. Why it is wrong: Kubernetes SIG Network and the Security Response Committee announced its retirement on 11 November 2025; since March 2026 it gets no releases or security fixes (AKS's Application Routing add-on support for it runs only to November 2026). Instead: Use a Gateway API implementation.
  • Mistake: Assuming one Application Gateway covers both Australian regions. Why it is wrong: It is a regional resource. Instead: Deploy one per region and fail over with Front Door or Traffic Manager.
  • Mistake: Ignoring where TLS is terminated for regulated data. Why it is wrong: A global edge decrypts traffic outside Australia for some users, which may conflict with a contract or an ISM-assessed system's data-handling rules. Instead: Check the data-handling requirement and use a regional edge or end-to-end TLS where needed.
  • Mistake: Running IIS out-of-process by habit. Why it is wrong: It adds a proxy hop to Kestrel for no benefit. Instead: Use in-process hosting unless you need process isolation.

🏛 Senior insight: trade-offs

The question I ask first is "what job is not done yet?" rather than "which gateway do we use?". Global users or multi-region DR means Front Door. Private-only traffic in a VNet means Application Gateway or internal ingress. External developers paying for or subscribing to APIs means API Management. Routing that needs code means YARP. If no job is unfilled, adding a component is cost without value. I also check data residency: Front Door processes requests at global edge locations, so for workloads that must keep traffic in Australia (some government and health systems), a regional Application Gateway in Australia East may be the safer edge.

Option When it fits Cost When not to
Front Door Public, global or multi-region, WAF at edge Base fee plus per request and data Private-only systems; strict in-country processing
Application Gateway Private or regional L7 in a VNet Hourly plus capacity units Global routing; you already have Front Door WAF
API Management Partner or public API products Tier based, Premium for multi-region Internal service-to-service calls
YARP Custom routing in C#, migrations, BFF Your compute and ops time A config rule in a managed service would do
Nginx / IIS VM hosting, legacy estates Patching and ops PaaS hosting

Measure overhead per hop with Front Door access logs (timeTaken vs origin time) and Application Insights end-to-end transactions.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions API Management or a backend-for-frontend Why: Checks what belongs in a gateway and the signs that too much logic has moved into it
    How to answer

    An API gateway is a single entry point in front of your services that routes requests and applies cross-cutting concerns: TLS termination, token validation, rate limiting and quotas, request ids, IP filtering, header rewriting and sometimes caching. Azure API Management is a managed gateway with XML policies, products and subscriptions, a developer portal and analytics; YARP is a .NET reverse-proxy library you host yourself and extend in C#. A backend-for-frontend (BFF) is a gateway per client (web, mobile) that aggregates and shapes data for that client. The danger is a smart gateway: business rules and orchestration in policies become untested, hard-to-version logic owned by nobody. Keep the gateway thin and services authoritative.

  2. When: Candidate mentions IIS hosting Why: Checks in-process vs out-of-process hosting with the ASP.NET Core Module
    How to answer

    Kestrel is the default, cross-platform server built into ASP.NET Core and is fine to run directly, which is what you do in containers and on Linux. On Windows with IIS, the ASP.NET Core Module (ANCM) connects IIS to your app in one of two ways: in-process (the default), where the app runs inside the IIS worker process w3wp.exe using IISHttpServer instead of Kestrel and is fastest on IIS; or out-of-process, where IIS reverse-proxies to Kestrel running in a separate dotnet process. HTTP.sys is a Windows-only, kernel-mode server for when you need Windows authentication, port sharing or kernel caching without IIS. The trade-off: Kestrel is portable and simple, IIS gives Windows process management, and HTTP.sys gives Windows features without IIS.

  3. When: Candidate says Front Door terminates TLS Why: Checks HTTPS redirection and HSTS behaviour when TLS ends at the edge
    How to answer

    TLS encrypts and authenticates the connection; HTTPS is HTTP over TLS. In ASP.NET Core, UseHttpsRedirection redirects plain-HTTP requests to HTTPS, and UseHsts adds the Strict-Transport-Security header so the browser refuses to use HTTP for that host for max-age (30 days by default), closing the first-request downgrade window after the first visit. Preload goes further: the domain is baked into browsers, so even the first visit is HTTPS — but it requires a year-long max-age, includeSubDomains, and is slow to undo.

    For APIs, don't depend on redirects: non-browser clients ignore HSTS and may already have sent a token over HTTP, so refuse HTTP instead. Behind a proxy, run UseForwardedHeaders first or the app thinks every request is HTTP and loops.

🛠 Real-world problems: how you handle them

Five proxy layers and a WAF bypass
Situation
[Insurance] customer portal API on AKS in Australia East with Front Door, Application Gateway, API Management and an ingress-nginx controller in front, serving about [400] requests per second.
Signals
p50 edge overhead around [35 ms]; intermittent 502s that nobody could attribute to a layer; a penetration test found the Application Gateway public IP answered directly, bypassing Front Door WAF.
Investigation
Mapped the path with Front Door access logs, Application Gateway access logs and Application Insights end-to-end transactions; compared `timeTaken` at each layer. Found duplicated WAF rule sets, four TLS terminations, mismatched timeouts (Front Door 60 s, Application Gateway 20 s) causing the 502s, and no origin lock-down.
Resolution
Immediately restricted the Application Gateway to the `AzureFrontDoor.Backend` service tag and checked `X-Azure-FDID`. Then removed Application Gateway (Front Door WAF covered it), replaced ingress-nginx with a Gateway API implementation ahead of its retirement, kept API Management only for partner routes, and aligned timeouts outer > inner.
Prevention
Architecture decision record with one owner per job (TLS, WAF, routing, API policy); a pipeline check that origins are not publicly reachable; dashboards of per-layer latency; quarterly review of edge components against the ADR.

How to tell it (STAR)

**S:** At [company] our portal API had five layers in front of it and a pen test showed attackers could skip the WAF entirely. **T:** I was asked to [lead the remediation] and simplify the edge without downtime. **A:** I traced requests through each layer's logs and Application Insights, found duplicated WAF, four TLS terminations and a 20-second timeout behind a 60-second one causing the 502s. I locked the origin to our Front Door profile first, then removed Application Gateway and moved from ingress-nginx to Gateway API, keeping API Management only for partner traffic. **R:** Edge overhead fell from about [35 ms] to [12 ms], the unexplained 502s stopped, the re-test found no bypass, and we cut about [$X] a month from the Azure bill.

More in Reverse Proxy and Gateway

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me