Cloudflare Load Balancers now support Session Affinity (also known as "Sticky Sessions") to the origin.
Enabling Session Affinity:
On a new Load Balancer:
1. In order to enable Session Affinity when creating a new Load Balancer, click on the optional Session Affinity drop down as below:
2. The dropdown will open, as below, to allow you to select the Cloudflare Cookie option:
On an existing Load Balancer:
1. Click on the Edit icon on the Load Balancer you would like to enable Session Affinity on
2. Click on the Session Affinity option dropdown
3. Select the By Cloudflare Cookie check box
Session Affinity by Cloudflare Cookie:
Cloudflare will set a cflb cookie with a unique value on the first response to the requesting client. On consequent requests with the same cookie, requests will be routed to the same origin.
In the event of a failover, Cloudflare will set a new cookie to reflect that requests should now be send to the failover pool.
We currently only support Session Affinity in "orange-cloud" (proxied) mode, though we intend to support "gray-clouded" (DNS-only) in the future.
Additionally while affinity is currently only available by cookie, in the future Cloudflare will also add support for Session Affinity by IP, as well as custom cookies and header.