Problem with Cloudflare and Magento 2


#1

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.

regards


#2

Have you already tried the official extension?


#3

Do you have any CF app installed ?


#4

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


#5

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


#6

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.


#7

Can you give me some advice on how to proceed?


#8

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: http://example.com/key.jpg 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.


#9

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?

PS
After reading that git https://github.com/magento/magento2/issues/9156 second post, I found that when cloudflare is on, X-Magenty-Vary cookie is missing.


#10

At this point it might be best to file a support ticket so that one of our engineers can look at your specific configuration. You can either visit support.cloudflrare.com or email support AT cloudflare DOT com.


#11

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


#12

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.


#13

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


#14

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