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, click on the optional Session Affinity drop down as below:

Traffic__mission-fig_com___Cloudflare_-_Web_Performance___Security.png

2. The dropdown will open, as below, to allow you to select the Cloudflare Cookie option:

Traffic__mission-fig_com___Cloudflare_-_Web_Performance___Security.png

On an existing Load Balancer:

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

Traffic__mission-fig_com___Cloudflare_-_Web_Performance___Security.png

2. Click on the Session Affinity option dropdownTraffic__mission-fig_com___Cloudflare_-_Web_Performance___Security.png

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.

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. 

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk