Azure Application Gateway request routing rules configuration (2024)

  • Article

When you create an application gateway using the Azure portal, you create a default rule (rule1). This rule binds the default listener (appGatewayHttpListener) with the default backend pool (appGatewayBackendPool) and the default backend HTTP settings (appGatewayBackendHttpSettings). After you create the gateway, you can edit the settings of the default rule or create new rules.

Rule type

When you create a rule, you choose between basic and path-based.

  • Choose basic if you want to forward all requests on the associated listener (for example, blog.contoso.com/*) to a single backend pool.
  • Choose path-based if you want to route requests from specific URL paths to specific backend pools. The path pattern is applied only to the path of the URL, not to its query parameters.

Order of processing rules

For the v1 and v2 SKU, pattern matching of incoming requests is processed in the order that the paths are listed in the URL path map of the path-based rule. If a request matches the pattern in two or more paths in the path map, the path that's listed first is matched. And the request is forwarded to the back end that's associated with that path.

If you have multiple listeners, it's even more important that rules are processed in the correct order so that client traffic is received by the correct listener. For more information about rules evaluation order, see Request Routing rules evaluation order.

Associated listener

Associate a listener to the rule so that the request-routing rule that's associated with the listener is evaluated to determine the backend pool to route the request to.

Associated backend pool

Associate to the rule the backend pool that contains the backend targets that serve requests that the listener receives.

  • For a basic rule, only one backend pool is allowed. All requests on the associated listener are forwarded to that backend pool.

  • For a path-based rule, add multiple backend pools that correspond to each URL path. The requests that match the URL path that's entered are forwarded to the corresponding backend pool. Also, add a default backend pool. Requests that don't match any URL path in the rule are forwarded to that pool.

Associated backend HTTP setting

Add a backend HTTP setting for each rule. Requests are routed from the application gateway to the backend targets by using the port number, protocol, and other information that's specified in this setting.

For a basic rule, only one backend HTTP setting is allowed. All requests on the associated listener are forwarded to the corresponding backend targets by using this HTTP setting.

For a path-based rule, add multiple backend HTTP settings that correspond to each URL path. Requests that match the URL path in this setting are forwarded to the corresponding backend targets by using the HTTP settings that correspond to each URL path. Also, add a default HTTP setting. Requests that don't match any URL path in this rule are forwarded to the default backend pool by using the default HTTP setting.

Redirection setting

If redirection is configured for a basic rule, all requests on the associated listener are redirected to the target. This is global redirection. If redirection is configured for a path-based rule, only requests in a specific site area are redirected. An example is a shopping cart area that's denoted by /cart/*. This is path-based redirection.

For more information about redirects, see Application Gateway redirect overview.

Redirection type

Choose the type of redirection required: Permanent(301), Temporary(307), Found(302), or See other(303).

Redirection target

Choose another listener or an external site as the redirection target.

Listener

Choose listener as the redirection target to redirect traffic from one listener to another on the gateway. This setting is required when you want to enable HTTP-to-HTTPS redirection. It redirects traffic from the source listener that checks for incoming HTTP requests to the destination listener that checks for incoming HTTPS requests. You can also choose to include the query string and path from the original request in the request that's forwarded to the redirection target.

Azure Application Gateway request routing rules configuration (1)

For more information about HTTP-to-HTTPS redirection, see:

  • HTTP-to-HTTPS redirection by using the Azure portal
  • HTTP-to-HTTPS redirection by using PowerShell
  • HTTP-to-HTTPS redirection by using the Azure CLI

External site

Choose external site when you want to redirect the traffic on the listener that's associated with this rule to an external site. You can choose to include the query string from the original request in the request that's forwarded to the redirection target. You can't forward the path to the external site that was in the original request.

For more information about redirection, see:

  • Redirect traffic to an external site by using PowerShell
  • Redirect traffic to an external site by using the CLI

Rewrite HTTP headers and URL

By using rewrite rules, you can add, remove, or update HTTP(S) request and response headers as well as URL path and query string parameters as the request and response packets move between the client and backend pools via the application gateway.

The headers and URL parameters can be set to static values or to other headers and server variables. This helps with important use cases, such as extracting client IP addresses, removing sensitive information about the backend, adding more security, and so on.For more information, see:

  • Rewrite HTTP headers and URL overview
  • Configure HTTP header rewrite
  • Configure URL rewrite

Next steps

  • Learn about HTTP settings
Azure Application Gateway request routing rules configuration (2024)

FAQs

What should you configure on the Application Gateway? ›

You can configure the application gateway to have a public IP address, a private IP address, or both. A public IP is required when you host a back end that clients must access over the Internet via an Internet-facing virtual IP (VIP).

How does an Application Gateway route a request? ›

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.

What is the maximum number of WAF rules in Azure? ›

The maximum number of WAF custom rules is 100. For more information about Application Gateway limits, see Azure subscription and service limits, quotas, and constraints. Any redirect rules applied at the application gateway level will bypass WAF custom rules.

How to configure gateway in Azure? ›

Create a gateway subnet

On the page for your virtual network, on the left pane, select Subnets to open the Subnets page. At the top of the page, select + Gateway subnet to open the Add subnet pane. The name is automatically entered as GatewaySubnet. Adjust the IP address range value, if necessary.

What is the main function of the Application Gateway in Azure? ›

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.

Which criteria does an Application Gateway use to route requests to a web server? ›

The users authentication information.
  • Which criteria does Application Gateway use to route requests to a web server?
  • The region in which the servers hosting the web application are located.
  • The hostname, port, and path in the URL of the request.
  • The IP address of the web server that is the target of the request.
Feb 23, 2024

What is request routing in API gateway? ›

Request routing—the API gateway is able to map between user requests and the back end services that can fulfill each request. It routes requests to one or more relevant services. Multiple requests for the same API are packaged into a single request to improve performance.

Which is the main advantage of having an Application Gateway? ›

Application gateways also permit the use of simpler filtering rules. Instead of having to route application traffic to several different systems, it only need be routed to the application gateway; all other traffic can be rejected.

What is the difference between Azure Application Gateway Standard and WAF? ›

Standard tier is used only for load balancing web traffic and routing the web requests to your backend servers. WAF tier is used along with the Application gateway load balancing and routing to protect your web applications from web vulnerabilities and attacks without modification to back-end code.

What is the difference between a gateway and a WAF? ›

WAFs are crucial to any. By integrating API gateways and WAFs, the gateway efficiently handles traffic, while the WAF focuses on securing against potential threats, creating a comprehensive solution for API management and security.

What is the difference between application gateway and firewall? ›

Firewall and Application Gateway in parallel

Azure WAF in Azure Application Gateway protects inbound traffic to the web workloads, and the Azure Firewall inspects inbound traffic for the other applications. The Azure Firewall will cover outbound flows from both workload types.

Is an application gateway a routing technique? ›

Application Gateway enables you to route traffic to multiple backend servers based on various routing rules, such as cookie-based affinity, session persistence, and round-robin load balancing.

What is path based routing vs host based routing? ›

Host-based routing allows you to route to multiple domains on a single load balancer by routing to a different set of EC2 instances or containers based on information in the host header. Path-based routing is also referred to as URL-based routing.

What is path-based routing in Azure? ›

URL Path Based Routing allows you to route traffic to backend server pools based on URL Paths of the request. One of the scenarios is to route requests for different content types to different backend server pools.

How should an on-premises data gateway be configured? ›

There are five main steps for using a gateway:
  1. Download and install the gateway on a local computer.
  2. Configure the gateway based on your firewall and other network requirements.
  3. Add gateway admins who can also manage and administer other network requirements.
  4. Use the gateway to refresh an on-premises data source.
Nov 1, 2022

What are features of an application level gateway? ›

ALGs provide an unparalleled degree of security by examining the content of the packets that pass through them rather than just headers. This allows a much deeper level of inspection, detecting specific applications and protocols and applying various security policies and controls based on the application's needs.

What is a gateway to the application? ›

App gateways are software-based solutions that run on industry-standard servers. They are deployed in the enterprise data center behind the firewall, without configuration changes. And they use standards-based protocols like SSL to encrypt data flowing over the public internet.

What protocols does Application Gateway support? ›

What protocols does Application Gateway support? Application Gateway supports HTTP, HTTPS, HTTP/2, and WebSocket.

Top Articles
Latest Posts
Article information

Author: Duane Harber

Last Updated:

Views: 6100

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.