Load Balancing: Session Affinity

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, toggle the optional Session Affinity to On.

create_load_balancer_load_balancing.png

On an existing Load Balancer:

1. Click on the Edit icon next to the Load Balancer you would like to enable Session Affinity on.

2. Toggle Session Affinity to On.


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.


Disclaimers

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. 

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk