Changing backend using slow rollout

We are planning to change our upstream but we would like to do a slow rollout where not all traffic is redirect at once. Is it possible to have for example 50% of the traffic go to the existing upstream and the other 50% go to the new one? Would it be possible to do this in 10% increments?

That sounds similar to A/B testing, and you can use this worker to do that:

Or a load balancer:

If using the worker solution, it looks like I would need to figure out how to change this code:

    if (cookie && cookie.includes(`${NAME}=control`)) {
      url.pathname = "/control" + url.pathname;
    } else if (cookie && cookie.includes(`${NAME}=test`)) {
      url.pathname = "/test" + url.pathname;

To not use URL patterns since we won’t be able to prefix our URL’s with control or test. I assume there must be some function call I would use to tell Cloudflare which upstream IP address (or hostname) to use on a per request basis?

Here’s another approach that may be easier. It’s random, but I suppose if you use ten entries, and gradually shift them to the new hostname, that would work, as well, though this will also need some customization to remove some of the options in the article.

Personally, I’d go with Load Balancing. It’s just $5/month, and pretty easy to set up.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.