Xenforo cookie issue

Hey Folks,

I’ve been using Cloudflare to help secure a small number of sites for the last few years, with no issue. However, a new issue has cropped up for the last couple of months, and I cant seem to find an answer anywhere.

So, I’m hoping this group may have an idea.

So, starting a few months ago, a handful of my forum users (running Xenforo) are constantly being logged out with every page refresh. This means that, somehow, the session cookies being written by the forum are somehow either being blocked, or invalidated.

I have a hosts entry for the site, and hit the sites servers directly, and have never seen the issue. Some users have the issue once every couple of days, and some have the issue every page refresh. One of my moderators was having the issue a lot, and once I gave him the hosts file work-around, his issue stopped completely, which is why I’m poking around here…

So… any ideas? Is there something in the Cloudflare configuration that might be causing this? Any input is appreciated.

How is the cookie exactly being set? Generally Cloudflare should not interfere with cookies but maybe you have a particular setup.

I’d suggest you disable your hosts file for a while and goes via Cloudflare too, to check whether you can reproduce the error. Additionally, if you can post the URL and create a test account maybe someone here could have a look too.

I can’t say exactly how its being set, its the Xenforo session cookie (and I didnt write it). Suddenly started happening a couple months ago, and I had not changed anything at all with the system. I’ve removed the entry from my hosts file, but I usually “stay logged in”. Guess ill remove that too, and just do temp logins like the users having the issue.

You might have better luck with that question at their forum, as they know what is going to set the cookie at what point. Without reproducability it is of course difficult to debug.

Maybe these might help

Be sure if you setup xenforo session caching, that you have it properly configured as per

Xenforo support forums are definitely the place to ask XenForo community

I moved my Xenforo 1.5 forum over to Cloudflare in May 2018 and haven’t had any such issues myself :slight_smile: FYI, I am caching Xenforo sessions to Redis cache via XF 1.5 addon though. While XF 2.x has native Redis cache support

From XF2 session cache manual


Your cache must have enough space to hold the sessions, or users may not be able to login properly. We do not recommend writing sessions to the cache if you are using APC as your cache provider.

This topic was automatically closed after 14 days. New replies are no longer allowed.