If you Google “cloudflare settings for wordpress” you will find a lot people giving tutorials how to speed up sites using cloudflare. Let me tell you all of them are bullshit. The more you optimize cloudflare the more problems you’re gonna face.
Here is the only settings where you won’t get any cache problems with keeping the cloudflare security.
Crypto -> SSL = Full
Speed -> Rocket Loader = Off
Caching -> Caching Level = No query string
Caching -> Browser Cache Expiration = Respect Existing Headers
Caching -> Always Online = Off
Firewall -> Security Level = High
Firewall -> Challenge Passage = 15 Minutes
Disable Cloudflare Caching
Cloudflare Caching is the most terrible thing. This is the culprit in most problems. If you are like me who hates cloudflare caching then create a Page Rules in cloudflare with the path
*example.com/* and select
Cache = Bypass
This rules will apply on the domain including all of its subdomains. For example:
example.com www.example.com subdomain.example.com *.example.com
Thanks to sdayman who helped me to achieve this.