How an application gateway works (2024)

  • Article

This article explains how an application gateway accepts incoming requests and routes them to the backend.

How an application gateway works (1)

How an application gateway accepts a request

  1. Before a client sends a request to an application gateway, it resolves the domain name of the application gateway by using a Domain Name System (DNS) server. Azure controls the DNS entry because all application gateways are in the azure.com domain.

  2. The Azure DNS returns the IP address to the client, which is the frontend IP address of the application gateway.

  3. The application gateway accepts incoming traffic on one or more listeners. A listener is a logical entity that checks for connection requests. It's configured with a frontend IP address, protocol, and port number for connections from clients to the application gateway.

  4. If a web application firewall (WAF) is in use, the application gateway checks the request headers and the body, if present, against WAF rules. This action determines if the request is valid request or a security threat. If the request is valid, it's routed to the backend. If the request isn't valid and WAF is in Prevention mode, it's blocked as a security threat. If it's in Detection mode, the request is evaluated and logged, but still forwarded to the backend server.

Azure Application Gateway can be used as an internal application load balancer or as an internet-facing application load balancer. An internet-facing application gateway uses public IP addresses. The DNS name of an internet-facing application gateway is publicly resolvable to its public IP address. As a result, internet-facing application gateways can route client requests from the internet.

Internal application gateways use only private IP addresses. If you're using a Custom or Private DNS zone, the domain name should be internally resolvable to the private IP address of the Application Gateway. Therefore, internal load-balancers can only route requests from clients with access to a virtual network for the application gateway.

How an application gateway routes a request

If a request is valid and not blocked by WAF, the application gateway evaluates the request routing rule that's associated with the listener. This action determines which backend pool to route the request to.

Based on the request routing rule, the application gateway determines whether to route all requests on the listener to a specific backend pool, route requests to different backend pools based on the URL path, or redirect requests to another port or external site.

Note

Rules are processed in the order they're listed in the portal for v1 SKU.

When the application gateway selects the backend pool, it sends the request to one of the healthy backend servers in the pool (y.y.y.y). The health of the server is determined by a health probe. If the backend pool contains multiple servers, the application gateway uses a round-robin algorithm to route the requests between healthy servers. This load balances the requests on the servers.

After the application gateway determines the backend server, it opens a new TCP session with the backend server based on HTTP settings. HTTP settings specify the protocol, port, and other routing-related settings that are required to establish a new session with the backend server.

The port and protocol used in HTTP settings determine whether the traffic between the application gateway and backend servers is encrypted (thus accomplishing end-to-end TLS) or is unencrypted.

When an application gateway sends the original request to the backend server, it honors any custom configuration made in the HTTP settings related to overriding the hostname, path, and protocol. This action maintains cookie-based session affinity, connection draining, host-name selection from the backend, and so on.

Note

If the backend pool:

  • Is a public endpoint, the application gateway uses its frontend public IP to reach the server. If there isn't a frontend public IP address, one is assigned for the outbound external connectivity.
  • Contains an internally resolvable FQDN or a private IP address, the application gateway routes the request to the backend server by using its instance private IP addresses.
  • Contains an external endpoint or an externally resolvable FQDN, the application gateway routes the request to the backend server by using its frontend public IP address. If the subnet contains service endpoints, the application gateway will route the request to the service via its private IP address. DNS resolution is based on a private DNS zone or custom DNS server, if configured, or it uses the default Azure-provided DNS. If there isn't a frontend public IP address, one is assigned for the outbound external connectivity.

Backend server DNS resolution

When a backend pool's server is configured with a Fully Qualified Domain Name (FQDN), Application Gateway performs a DNS lookup to get the domain name's IP address(es). The IP value is stored in your application gateway's cache to enable it to reach the targets faster when serving incoming requests.

The Application Gateway retains this cached information for the period equivalent to that DNS record's TTL (time to live) and performs a fresh DNS lookup once the TTL expires. If a gateway detects a change in IP address for its subsequent DNS query, it will start routing the traffic to this updated destination. In case of problems such as the DNS lookup failing to receive a response or the record no longer exists, the gateway continues to use the last-known-good IP address(es). This ensures minimal impact on the data path.

Important

  • When using custom DNS servers with Application Gateway's Virtual Network, it is important that all servers respond consistently with the same DNS values. When an instance of your Application Gateway issues a DNS query, it uses the value from the server that responds first.
  • Users of on-premises custom DNS servers must ensure connectivity to Azure DNS through Azure DNS Private Resolver (recommended) or a DNS forwarder VM when using a Private DNS zone for Private endpoint.

Modifications to the request

Application gateway inserts six additional headers to all requests before it forwards the requests to the backend. These headers are x-forwarded-for, x-forwarded-port, x-forwarded-proto, x-original-host, x-original-url, and x-appgw-trace-id. The format for x-forwarded-for header is a comma-separated list of IP:port.

The valid values for x-forwarded-proto are HTTP or HTTPS. X-forwarded-port specifies the port where the request reached the application gateway. X-original-host header contains the original host header with which the request arrived. This header is useful in Azure website integration, where the incoming host header is modified before traffic is routed to the backend. If session affinity is enabled as an option, then it adds a gateway-managed affinity cookie.

X-appgw-trace-id is a unique guid generated by application gateway for each client request and presented in the forwarded request to the backend pool member. The guid consists of 32 alphanumeric characters presented without dashes (for example: ac882cd65a2712a0fe1289ec2bb6aee7). This guid can be used to correlate a request received by application gateway and initiated to a backend pool member via the transactionId property in Diagnostic Logs.

You can configure application gateway to modify request and response headers and URL by using Rewrite HTTP headers and URL or to modify the URI path by using a path-override setting. However, unless configured to do so, all incoming requests are proxied to the backend.

Next steps

  • Learn about application gateway components
  • Review Azure Application Gateway features
How an application gateway works (2024)

FAQs

How does an application gateway work? ›

Based on the request routing rule, the application gateway determines whether to route all requests on the listener to a specific backend pool, route requests to different backend pools based on the URL path, or redirect requests to another port or external site.

What are the limitations of application gateways? ›

Application gateways are susceptible to IP spoofing. Application gateways are not good and understanding protocols such as telnet. Client software must be "smart" and know to contact the gateway. Each application to be managed needs its own gateway.

Does an application gateway need a separate subnet? ›

An application gateway is a dedicated deployment in your virtual network. Within your virtual network, a dedicated subnet is required for the application gateway. You can have multiple instances of a specific Application Gateway deployment in a subnet. You can also deploy other application gateways in the subnet.

How does Application Level Gateway work? ›

By acting as a proxy for the application servers and managing application protocols such as SIP and FTP, an application layer gateway typically uses deep packet inspection to detect and block attacks before initiating an application session or allowing traffic to pass to the application.

Is an application gateway a load balancer? ›

Azure Application Gateway is a web traffic (OSI layer 7) load balancer that enables you to manage traffic to your web applications. Traditional load balancers operate at the transport layer (OSI layer 4 - TCP and UDP) and route traffic based on source IP address and port, to a destination IP address and port.

What are the disadvantages of application gateways? ›

Disadvantages of Application-Level Gateways

The stricter the monitoring rules on the proxy server, the slower the data flow. Proxy firewalls also have major compatibility problems, as they can't support a wide variety of connection types and network protocols.

Which is the main advantage of having an application gateway? ›

App gateways help businesses improve user satisfaction by simplifying and unifying remote access security, and they reduce IT operations expense and complexity by eliminating the need for costly and complicated VPNs.

Is application gateway a firewall? ›

Application gateway firewalls can distribute incoming traffic across multiple backend servers to ensure that no single one is overloaded. For users, this means better uptime, ensuring that the service is always up and running when needed.

Do I need an application gateway? ›

Azure Application Gateway helps in managing the traffic directed towards users' web applications. In addition, it has autoscaling features that help in deploying and as it is integrated into Azure is more secure.

What should you configure on the application gateway? ›

To establish connections from the client-side, the application gateway is configured with a frontend IP address, protocol, and port number. If a web application firewall (WAF) is in use, the application gateway checks the request headers and the body, if present, against WAF rules.

What is throughput in an application gateway? ›

Throughput. Number of bytes per second the Application Gateway has served. Total Requests. Count of successful requests that Application Gateway has served. The request count can be further filtered to show count per each/specific backend pool-http setting combination.

How do I set up an application gateway? ›

Download the App Gateway binary file, install the App Gateway server, register the App Gateway using Identity Cloud Service console, configure the App Gateway server, assign an enterprise application, start the App Gateway server, and test the access to the application through App Gateway.

How does a gateway server work? ›

A gateway server is a device that brokers transactions between a client computer and another server. It transforms data streams to match device capabilities. For example, a WAP (Wireless Application Protocol) gateway server transforms HTML to WML (Wireless Markup Language) for the client's wireless device.

What is the difference between application gateway and WAF? ›

WAF is an additional setting for the application gateway. It's used to increase the security of applications behind the application gateway, and it also provides centralized protection.

Is an application gateway a firewall? ›

An application gateway (ALG) firewall is a type of firewall that protects the application layer of the OSI model.

Top Articles
Three Years Later: How the Pandemic Changed Us | Duke Today
Money Mindset for Christians
Netronline Taxes
Www.1Tamilmv.cafe
Cumberland Maryland Craigslist
Melfme
Optimal Perks Rs3
Unraveling The Mystery: Does Breckie Hill Have A Boyfriend?
Ecers-3 Cheat Sheet Free
My.doculivery.com/Crowncork
ATV Blue Book - Values & Used Prices
zopiclon | Apotheek.nl
No Strings Attached 123Movies
Ivegore Machete Mutolation
Insidekp.kp.org Hrconnect
Premier Reward Token Rs3
Fool’s Paradise movie review (2023) | Roger Ebert
Wisconsin Women's Volleyball Team Leaked Pictures
Velocity. The Revolutionary Way to Measure in Scrum
The Exorcist: Believer (2023) Showtimes
E22 Ultipro Desktop Version
Why Should We Hire You? - Professional Answers for 2024
Quest: Broken Home | Sal's Realm of RuneScape
Rufus Benton "Bent" Moulds Jr. Obituary 2024 - Webb & Stephens Funeral Homes
Pasco Telestaff
Terry Bradshaw | Biography, Stats, & Facts
Okc Body Rub
Wkow Weather Radar
Chamberlain College of Nursing | Tuition & Acceptance Rates 2024
Boise Craigslist Cars And Trucks - By Owner
Finding Safety Data Sheets
Booknet.com Contract Marriage 2
Random Bibleizer
Craigslist Auburn Al
Craigslist Boerne Tx
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Blackstone Launchpad Ucf
Los Garroberros Menu
Winco Money Order Hours
Mid America Clinical Labs Appointments
Noaa Duluth Mn
Cl Bellingham
Trivago Sf
Joey Gentile Lpsg
Shell Gas Stations Prices
Ups Authorized Shipping Provider Price Photos
Missed Connections Dayton Ohio
Used Auto Parts in Houston 77013 | LKQ Pick Your Part
Jesus Calling Oct 6
ats: MODIFIED PETERBILT 389 [1.31.X] v update auf 1.48 Trucks Mod für American Truck Simulator
Cataz.net Android Movies Apk
Supervisor-Managing Your Teams Risk – 3455 questions with correct answers
Latest Posts
Article information

Author: Wyatt Volkman LLD

Last Updated:

Views: 5998

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Wyatt Volkman LLD

Birthday: 1992-02-16

Address: Suite 851 78549 Lubowitz Well, Wardside, TX 98080-8615

Phone: +67618977178100

Job: Manufacturing Director

Hobby: Running, Mountaineering, Inline skating, Writing, Baton twirling, Computer programming, Stone skipping

Introduction: My name is Wyatt Volkman LLD, I am a handsome, rich, comfortable, lively, zealous, graceful, gifted person who loves writing and wants to share my knowledge and understanding with you.