Problem with Cloudflare and Magento 2


Hi everyone,
I have a strange problem with magento 2 and one of the good selling themes in themeforest. The problem is not present with default magento 2 theme.
When I am signed in to the store, it still shows me sign in button instead of sign out button. When I clear the magento 2 full page cache, the problem dissapears, but when I open the page from another browser with not signed in user and refresh the page on signed in browser it appears again.
After several days of investigation I have found that the problem is caused by cloudflare, which I use also to manage that domain.
Turning on and off any feature in cloudflare panel didn’t help. The only solution was to bypass cloudflare from domain register.
I have tried different page rules, bypassing caching, security… and none of them helped.
What could cause that issue, because I want to use cloudflare in front of my store.



Have you already tried the official extension?


Do you have any CF app installed ?


Yes, I have installed that module and didn’t change anything.


I have removed all cloudflare apps, enabled and disabled every cloudflare feature and nothing helped.


Sounds like your theme is using a non standard way of using a resoource as a cookie which is cached by Cloudflare. You need to find that resource and prevent it from caching.


Can you give me some advice on how to proceed?


Consider this case: developer tries to retrieve a resource from server (i.e. a key) which is different on each request. For example resource url is: which is not a static resource at server side (each request returns a unique content) and client is aware how to use that. But behind a service like CF that cause problem since CF will caches the result.


I still couldnt found a solution. Even with disabled security, performance, apps, cache level bypass, doesnt works as expected.
When I bypass from dns settings (make them gray) works fine.
What else can be checked?

After reading that git second post, I found that when cloudflare is on, X-Magenty-Vary cookie is missing.


At this point it might be best to file a support ticket so that one of our engineers can look at your specific configuration. Login to Cloudflare and then contact Cloudflare Support


Hi @ryan
I have opened a ticket 4 days ago but still no response.


I think I found your ticket. Let me see if I can get some eyes on it. The FREE queue has been quite busy this week.


7 8 days ago support requested HAR file, I have send it, but still no responce.


It looks like your Support Engineer got back to you early this morning. Looks like he’s working on another update. Stay tuned.