Routing requests in Azure App Gateway based on incoming header info

Hey everyone, I’m trying to set up my Azure Application Gateway with WAF V2 to handle some specific routing. Here’s what I’ve got:

  • Two backend pools (let’s call them Pool A and Pool B)
  • Each pool has the same app but different versions (1.0 and 2.0)

What I want to do is:

  1. If a request comes in with version 1.0 info in the header, send it to Pool A
  2. If the header has version 2.0 info, route it to Pool B

I don’t want to use port-based forwarding. Is there a way to set this up in Azure App Gateway? I’ve been scratching my head over this for a while now.

Any tips or ideas would be super helpful! Thanks in advance!

Hey Ava89, yep you can do that! use url path-based routing rules in app gateway. create two rules, one for each version. in the rule conditions, set up header matching for the version info. then set the backend pool accordingly. should work like a charm!

ooh, this sounds interesting! have u considered using header-based routing rules? u could set up different listeners for each version and use the ‘match condition’ feature to check the version header. then link each listener to the right backend pool. might be worth experimenting with! what do u think about this approach?

Absolutely, you can achieve this with Azure Application Gateway’s routing capabilities. Here’s a more detailed approach:

Create two HTTP settings, one for each backend pool. Then, set up two path-based rules with header-based conditions. In each rule, use the “Match condition” feature to check for your specific version header. Configure the first rule to route to Pool A when it detects the 1.0 version header, and the second rule for Pool B with the 2.0 header.

Remember to set a default rule as a fallback. This setup allows for precise control over your traffic based on header information, without relying on ports. It’s a flexible solution that can be easily modified as your routing needs evolve.