lundi 23 octobre 2017

IIS Rewrite rules with random probability of 50/50?

I want to create two IIS rewrite rules, such that rule A will run on 50% of the requests, and B on the other 50%. There is no builtin random property in the IIS rewrite module AFAIK. I want to achieve it without developing my own rewrite module extension.

I prefer the random to be as "true" as possible (as far as pseudo-random algorithms can be random of course).

I thought about two possibilities:

  1. Get the current timestamp and use the parity of the timestamp. Is there such server variable available? I didn't find it.
  2. Use the parity of the last part of the client IP (REMOTE_ADDR).

Are one of these options feasible? How can I implement them with rewrite rules? Is there a better solution?

Aucun commentaire:

Enregistrer un commentaire