I am designing a service that needs to route requests based on the remainder from the division of a path or query string parameter by a constant value. For example, let's say the incoming address looks like abc.com/1234 and that the constant's value is 5.
Here is a list of sample incoming requests paths, underlying expression, and desired routes:
| Incoming | Expression | Route |
|:---------|:----------:| -----:|
| abc.com/10 | 10 % 5 = 0 | xyz-0.com |
| abc.com/11 | 11 % 5 = 1 | xyz-1.com |
| abc.com/12 | 12 % 5 = 2 | xyz-2.com |
| abc.com/17 | 17 % 5 = 2 | xyz-2.com |
This question mentions the same kind of rewrite/redirect, but regex replace seems to not be supported.
Would it be possible to achieve this with Azure Application Gateway rewrites (or Azure Front Door; looks to have the same capabilities as AG as far as rewrites go)?