Answered by:
Routing Rules based on custom cookies

Question
-
We're looking to launch new features on new infrastructure alongside our existing Web Apps, and were hoping to use Front Door or Application Gateway to help us manage routing requests, allowing for a single, consistent host name, and to simplify the application logic.
Ideally we'd like to offer visitors to our site the ability to opt in to these new experiences, whereby we set a cookie or similar, and then when they visited an updated section, they would be directed to the new infrastructure, but if they hadn't opted in, they would remain on the original application.
So the psuedo-code rule would be something like:
path = /area/* AND HTTP_COOKIE = ShowBeta=true
This is kind of possible with Application Request Routing within IIS and also a feature on some other cloud platforms but we're looking to use Azure PaaS offerings where possible - is this something I can do with the existing features in Azure, or are we limited to running something like HAProxy or nginx on a VM or dropping Cloudflare in front with some custom workers?
The site in question is already behind an Azure Verizon Standard CDN, would upgrading this to Premium allow us to route traffic in the desired way?
Life's a game... play it well
Monday, September 2, 2019 1:13 PM
Answers
-
Hi Zhaph,
Request routing based on the request headers are currently not support in both Application Gateway as well as Azure Front Door.
You can only rewrite the request header as of today with Application Gateway V2 SKU.
So, you should either go for any 3rd part load balancer which does the functionality that you mentioned or use the IAAS VM with IIS and ARR (This is not recommended as this needs maintenance from your end )
Let me know if you have any further questions.
Regards,
Msrini
- Proposed as answer by msrini - MSFTMicrosoft employee Monday, September 2, 2019 4:32 PM
- Marked as answer by Zhaph - Ben Duguid Tuesday, September 17, 2019 7:53 AM
Monday, September 2, 2019 4:32 PM
All replies
-
Hi,
You can use Application Gateway or Azure Front door to achieve what you asked for. The name of the feature is "URL based routing".
If you want your content to be cached and the content needs to be available ready at POP locations, then you can go with Azure Frontdoor.
If you are looking for regional deployment, then Application Gateway will be the best fit.
Let me know if you have any further questions.
Regards,
- Proposed as answer by msrini - MSFTMicrosoft employee Monday, September 2, 2019 3:54 PM
- Unproposed as answer by Zhaph - Ben Duguid Monday, September 2, 2019 4:27 PM
Monday, September 2, 2019 3:54 PM -
Hi Msrini - are there any examples of using custom cookies to affect routing? As far as I can see both of those route traffic solely based on the URL path, and then internally use an affinity cookie to provide sticky sessions to a particular backend host.
I'd like a visitor to be able to opt in to a specific routing method, and so need to be able to control the routing hash based on the custom cookie - as far as I can see, the "Custom Affinity Cookie" is used once a backend pool has been chosen, but has no impact on the chosen server and can be ignored?
To be clear my ideal requirement is:
Incoming Request: https://example.com/feature/page
- If cookie "ShowBeta=true" use backend pool "NewFeatures" (https://test.example.com/feature/page)
- If cookie "ShowBeta=false" (or not set) use backend pool "Origin" (https://origin.example.com/feature/page)
Incoming Request: https://example.com/someotherfeature/page
- Irrespective of cookie use backend pool "origin"
So I need to be able adjust the routing based on URL and other headers in the request, not just on path.
Life's a game... play it well
Monday, September 2, 2019 4:27 PM -
Hi Zhaph,
Request routing based on the request headers are currently not support in both Application Gateway as well as Azure Front Door.
You can only rewrite the request header as of today with Application Gateway V2 SKU.
So, you should either go for any 3rd part load balancer which does the functionality that you mentioned or use the IAAS VM with IIS and ARR (This is not recommended as this needs maintenance from your end )
Let me know if you have any further questions.
Regards,
Msrini
- Proposed as answer by msrini - MSFTMicrosoft employee Monday, September 2, 2019 4:32 PM
- Marked as answer by Zhaph - Ben Duguid Tuesday, September 17, 2019 7:53 AM
Monday, September 2, 2019 4:32 PM -
Hi,
Do you have any update on this issue?
Regards,
Msrini
Wednesday, September 4, 2019 4:09 PM -
Hi,
Do you have any update on this issue?
Regards,
Msrini
Thursday, September 5, 2019 1:38 PM -
Hi,
Just checking in if you have had a chance to see the previous response. If this answers your query, do click “Mark as Answer” and Up-Vote for the same.
Regards,
Msrini
Wednesday, September 11, 2019 9:20 AM -
Hi,
Just checking in if you have had a chance to see the previous response. If this answers your query, do click “Mark as Answer” and Up-Vote for the same.
Regards,
Msrini
Friday, September 13, 2019 12:16 PM