0
0
Azurecloud~10 mins

Application Gateway (Layer 7) in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Application Gateway (Layer 7)
Client sends HTTP/HTTPS request
Application Gateway receives request
Inspect request at Layer 7 (HTTP)
Apply routing rules based on URL/path/headers
Forward request to appropriate backend pool
Backend pool processes request and sends response
Application Gateway forwards response to client
The Application Gateway receives client requests, inspects them at the web layer, applies routing rules, and forwards them to backend servers, then returns responses.
Execution Sample
Azure
az network application-gateway create \
  --name myAppGateway \
  --resource-group myResourceGroup \
  --location eastus \
  --sku Standard_v2 \
  --frontend-port 80 \
  --http-settings-cookie-based-affinity Enabled \
  --routing-rule-type PathBasedRouting
This command creates an Application Gateway that listens on port 80 and routes requests based on URL paths.
Process Table
StepActionRequest DetailRouting DecisionBackend Pool SelectedResponse
1Client sends HTTP GETGET /images/logo.pngMatch path /images/*BackendPool1 (Image Servers)Response from Image Server
2Client sends HTTP GETGET /api/dataMatch path /api/*BackendPool2 (API Servers)Response from API Server
3Client sends HTTP GETGET /homeDefault routing ruleBackendPool3 (Web Servers)Response from Web Server
4Client sends HTTPS POSTPOST /api/uploadMatch path /api/*BackendPool2 (API Servers)Response from API Server
5Client sends HTTP GETGET /unknownpathDefault routing ruleBackendPool3 (Web Servers)Response from Web Server
6Request with no matching ruleGET /no-matchDefault routing ruleBackendPool3 (Web Servers)Response from Web Server
7End of requests----
💡 All requests processed and routed according to path-based rules or default rule.
Status Tracker
VariableStartAfter 1After 2After 3After 4After 5Final
Request Path-/images/logo.png/api/data/home/api/upload/unknownpath/no-match
Routing Rule Matched-/images/*/api/*default/api/*defaultdefault
Backend Pool-BackendPool1BackendPool2BackendPool3BackendPool2BackendPool3BackendPool3
Response-Image ServerAPI ServerWeb ServerAPI ServerWeb ServerWeb Server
Key Moments - 3 Insights
Why does a request to /unknownpath go to the default backend pool?
Because /unknownpath does not match any specific path-based routing rule, the Application Gateway uses the default routing rule as shown in execution_table row 5.
How does the Application Gateway decide which backend pool to send the request to?
It inspects the HTTP request path and matches it against configured routing rules. The matched rule determines the backend pool, as seen in execution_table rows 1-4.
What happens if no routing rule matches the request path?
The Application Gateway forwards the request to the default backend pool, ensuring the request is still handled, as shown in execution_table rows 5 and 6.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, which backend pool handles the request for GET /api/data?
ABackendPool1 (Image Servers)
BBackendPool2 (API Servers)
CBackendPool3 (Web Servers)
DNo backend pool
💡 Hint
Check execution_table row 2 under 'Backend Pool Selected'
At which step does the Application Gateway use the default routing rule for the first time?
AStep 1
BStep 3
CStep 5
DStep 2
💡 Hint
Look at execution_table rows and find where 'Routing Decision' is 'Default routing rule'
If a new path-based rule for /blog/* is added, how would the routing change for GET /blog/post1?
AIt would route to BackendPool1
BIt would route to BackendPool2
CIt would route to a new backend pool for blog
DIt would still route to the default backend pool
💡 Hint
Adding a new path-based rule directs matching requests to its specific backend pool instead of default
Concept Snapshot
Application Gateway (Layer 7) routes web traffic based on HTTP details like URL paths.
It inspects requests, applies routing rules, and forwards to backend pools.
Supports path-based routing, cookie affinity, and SSL termination.
Default rule handles unmatched requests.
Configured via Azure CLI or portal with frontend, backend pools, and routing rules.
Full Transcript
An Azure Application Gateway works at Layer 7, the web layer, to route client HTTP/HTTPS requests. When a client sends a request, the gateway inspects the URL path and other HTTP details. It matches the request against routing rules configured to direct traffic to specific backend pools. For example, requests to /images/* go to image servers, /api/* to API servers, and others to a default web server pool. If no specific rule matches, the default backend pool handles the request. This ensures all requests are served appropriately. The gateway then forwards the backend response back to the client. This process allows flexible, secure, and efficient web traffic management.