以下是我的网站环境:
- WordPress 3.8.1
- CloudFlare Pro计划
1.问题
将自定义DNS更改为CloudFlare后,我无法登录WordPress,以下是错误消息:
ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress
PS浏览器的cookie已启用。
这是CloudFlare的页面规则
Custom caching : Cache everything
*.example.com/*
2.解决方案–专业计划
要解决此问题,请禁用WordPress管理员,登录和预览页面的缓存。 再创建三个CloudFlare页面规则,如下所示:
Custom caching : Bypass cache
*.example.com/wp-admin/*
*.example.com/wp-login.php*
*.example.com/*&preview=true
并关闭所有CloudFlare功能,例如:Rocket Loader,性能,始终在线,缓存等,您不需要CloudFlare即可处理WordPress管理功能。
总结,总共有四个页面规则:
*.example.com/wp-admin/* //disabled everything
*.example.com/wp-login.php* //disabled everything
*.example.com/*&preview=true //disabled everything
*.example.com/* //enabled any features you want
3.解决方案–免费计划
对于CloudFlare免费计划,只有一个页面规则,请尝试定义以下页面规则模式:
*.example.com/wp-*
注意
我正在使用CloudFlare的专业计划,无法在免费计划环境中进行测试,请让我知道以上页面规则是否有效。
参考文献
标签: cloudflare
翻译自: https://mkyong.com/wordpress/cloudflare-wordpress-admin-cache-issue/