Hello Hanh Trinh
Session persistence is breaking due to Cloudflare’s changing source IP addresses. Since Azure Load Balancer supports only Client IP-based session persistence, but Cloudflare masks client IPs, you're facing session drops.
Possible Solutions to Maintain Session Persistence:
- Configure Azure Application Gateway (Instead of ALB)
Azure Application Gateway supports cookie-based session affinity, which ensures user sessions remain intact even if the source IP changes.
Enable session affinity cookies by setting Affinity Mode: Enabled.
- Use Cloudflare’s Header for Originating IP
Cloudflare provides headers like CF-Connecting-IP that preserve the original client IP.
You can configure your Azure Load Balancer or F5 BIG-IP to read and persist sessions based on this header.
- Implement F5 BIG-IP Sticky Sessions
Since F5 BIG-IP devices are standalone and do not sync, configuring session persistence within each F5 may help:
Enable Sticky Sessions (Persistence Profiles) on F5 BIG-IP.
I hope this has been helpful!
If above is unclear and/or you are unsure about something add a comment below.
If the response was helpful, please feel free to mark it as “Accepted Answer” and consider giving it an upvote. This helps others in the community as well.