Load Balancing by HTTP Header Hash

At present, all incoming requests go through HA Proxy which looks at an HTTP header with an Account ID, hashes that value, and directs all connections with that same value to the same API server.

I’d be happy to remove my dependence on HA Proxy and let Cloudflare handle this directly, but in glancing at the load balancing service, it doesn’t appear that there’s any way to accomplish this. The closest thing I can find is the “CFLib” cookie, but that just makes the API server “sticky” for a particular user, not all users for an account.

Is there another way to accomplish what HA Proxy is doing?

Thanks.

Additionally, it looks like Custom Load Balancing Rules, which would let me reference http.request.headers[“account-id”], gets me pretty close to what I’m looking for, and lets me override session affinity and steering policy, but I’m not seeing how to coax this to basically use the header account id for steering, dynamically, to a consistent API server.

Am I missing some obvious solution?