Random guy
Random guy

Reputation: 53

Azure application gateway - Routing based on cookie value

All of the examples I can find in the internet talk mostly about routing based on path. I have a scenario where I need to read a cookie and based on that cookie, route the request to a particular backend pool. Ideally it would be great if it was possible to read the cookie value and then redirect to the backend pool with the same name. But I'm not sure if any on this is even possible. So, does anyone have any idea if routing based on a cookie value is possible?

Upvotes: 3

Views: 1583

Answers (2)

ipper
ipper

Reputation: 784

New developments. V2 has some capabilities that could be used. See: https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-url#parameter-based-path-selection

Routing based on cookie value

Default path -> /* -> Default pool
Path 1 -> /webappA/ -> Web App A pool
Path 2-> /webappB/ -> Web App B pool

Then, URL rewrite configuration can be,

Condition – If COOKIEX=1, rewrite URL path to /webappA/
Condition – If COOKIEX=0, rewrite URL path to /webappB/
Re-evaluate path map = enabled

Upvotes: 3

ipper
ipper

Reputation: 784

"Cookie based routing is not possible with Application Gateway as of today."

This statement was from July 2019, so maybe there are new developments.

https://social.msdn.microsoft.com/Forums/en-US/256d36b1-d6f0-4f59-be04-b7b71308739e/node-selection-through-application-gateway?forum=WAVirtualMachinesVirtualNetwork

Upvotes: 1

Related Questions