{"id":735,"date":"2017-01-02T00:00:00","date_gmt":"2017-01-02T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/how-to-setup-cloudflare-for-wordpress\/"},"modified":"2026-10-22T10:07:00","modified_gmt":"2026-10-22T10:07:00","slug":"how-to-setup-cloudflare-for-wordpress","status":"publish","type":"post","link":"\/tutorials\/how-to-setup-cloudflare-for-wordpress\/","title":{"rendered":"How to set up Cloudflare for WordPress"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Cloudflare improves WordPress website performance and security through its content delivery network (CDN), caching, DDoS protection, and SSL\/TLS features. To set it up, add your domain to Cloudflare, configure its DNS records, update your nameservers, and enable HTTPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also connect Cloudflare to WordPress through its official plugin to manage caching and additional optimizations. However, the plugin isn&#8217;t required for basic CDN functionality.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial covers the complete setup process, recommended Cloudflare settings for WordPress, and how to verify that everything works correctly.<\/p>\n\n\n\n\n\n\n<h2 id=\"h-1-create-a-cloudflare-account\" class=\"wp-block-heading h-t-title-2\">1. Create a Cloudflare account<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, create a free account on the Cloudflare website. You&#8217;ll use the dashboard to manage your domain&#8217;s DNS, caching, security, and performance settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re unfamiliar with this technology, understanding <a data-click-id=\"hgr-post-content-link-how-a-cdn-works\" href=\"\/tutorials\/what-is-cdn\/\">how a CDN works<\/a> can help you choose the most useful settings for your website.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Visit <a data-click-id=\"hgr-post-content-link-cloudflare\" href=\"https:\/\/www.cloudflare.com\/\" target=\"_blank\" rel=\"noopener\">Cloudflare<\/a> and select Sign Up.<\/li>\n\n\n\n<li>Enter your email address and create an account.<\/li>\n\n\n\n<li>Complete any required email verification and sign in to the dashboard.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-cloudflare_s-si\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\"><img decoding=\"async\" width=\"1143\" height=\"662\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\/w=1024,h=1024,fit=scale-down\" alt=\"Cloudflare's sign up page\n\" class=\"wp-image-70507\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\/w=1143,fit=scale-down 1143w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-sign-up-page.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1143px) 100vw, 1143px\" \/><\/a><\/figure>\n<\/div>\n\n\n<h2 id=\"h-2-add-your-wordpress-domain-to-cloudflare\" class=\"wp-block-heading h-t-title-2\">2. Add your WordPress domain to Cloudflare<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, add the domain connected to your WordPress website. Cloudflare will guide you through selecting a plan and importing existing DNS records.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open the Cloudflare dashboard and choose the option to add a domain.<\/li>\n\n\n\n<li>Enter your domain name, such as <code>example.com<\/code>, without the <code>https:\/\/<\/code> prefix or page path.<\/li>\n\n\n\n<li>Select a Cloudflare plan. The Free plan provides core CDN, DNS, SSL\/TLS, and security features suitable for many WordPress websites.<\/li>\n\n\n\n<li>Continue to the DNS configuration step.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-cloudflare_s-ad\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\"><img decoding=\"async\" width=\"1290\" height=\"580\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\/w=1024,h=1024,fit=scale-down\" alt=\"Cloudflare's add site button\n\" class=\"wp-image-70509\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\/w=1290,fit=scale-down 1290w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-add-site-button.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1290px) 100vw, 1290px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Paid plans offer additional security, performance, and support features, but they&#8217;re not required for a standard WordPress CDN setup.<\/p>\n\n\n\n<h2 id=\"h-3-review-your-domains-dns-records\" class=\"wp-block-heading h-t-title-2\">3. Review your domain&#8217;s DNS records<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before changing your nameservers, verify that Cloudflare has imported the <a data-click-id=\"hgr-post-content-link-dns-records\" href=\"\/tutorials\/what-is-dns\/\">DNS records<\/a> required for your website and email services. Missing or incorrect records can make your website unavailable or interrupt email delivery.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Cloudflare automatically scans for common DNS records, but the results may be incomplete.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open your domain&#8217;s DNS records in Cloudflare.<\/li>\n\n\n\n<li>Compare the imported records with those from your current DNS provider.<\/li>\n\n\n\n<li>Check that your root domain&#8217;s A or AAAA record points to the correct hosting server, or that its CNAME uses the correct target.<\/li>\n\n\n\n<li>Confirm that the <code>www<\/code> record points to the correct destination.<\/li>\n\n\n\n<li>Verify that all email-related records, including MX, SPF, DKIM, and DMARC where used, are present.<\/li>\n\n\n\n<li>Add any missing records before proceeding.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-cloudflare-revi\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\"><img decoding=\"async\" width=\"1275\" height=\"827\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\/w=1024,h=1024,fit=scale-down\" alt=\"Cloudflare review DNS records\n\" class=\"wp-image-70512\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\/w=1275,fit=scale-down 1275w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-review-DNS-records.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1275px) 100vw, 1275px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">For regular WordPress website traffic, the root domain and <code>www<\/code> records can typically use Cloudflare&#8217;s <strong>Proxied<\/strong> status, indicated by an orange cloud.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep email and other services that don&#8217;t support Cloudflare&#8217;s HTTP proxy set to <strong>DNS only<\/strong>, indicated by a gray cloud. This commonly includes hostnames used for mail, FTP, and similar services.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re unsure what a record does, check your existing provider&#8217;s configuration before modifying it. Incorrect DNS settings can affect services beyond your WordPress website.<\/p>\n\n\n\n<h2 id=\"h-4-update-your-domains-nameservers\" class=\"wp-block-heading h-t-title-2\">4. Update your domain&#8217;s nameservers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;ve verified your DNS records, update your domain&#8217;s nameservers so Cloudflare can manage its DNS configuration and proxy eligible website traffic.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding, check whether DNSSEC is enabled at your current DNS provider. If your registrar has an existing DS record, follow Cloudflare&#8217;s instructions to remove the old record before changing nameservers. You can configure DNSSEC again through Cloudflare after activation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To update the nameservers:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open your domain&#8217;s Overview page in Cloudflare.<\/li>\n\n\n\n<li>Copy the two nameservers assigned to your domain.<\/li>\n\n\n\n<li>Sign in to the registrar where your domain is registered.<\/li>\n\n\n\n<li>Locate the domain&#8217;s nameserver management settings.<\/li>\n\n\n\n<li>Replace the existing nameservers with the two values provided by Cloudflare.<\/li>\n\n\n\n<li>Save the changes.<\/li>\n\n\n\n<li>Return to Cloudflare and confirm the nameserver update, if prompted.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-cloudflare_s-ch\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\"><img decoding=\"async\" width=\"1271\" height=\"910\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\/w=1024,h=1024,fit=scale-down\" alt=\"Cloudflare's change nameservers instruction\n\" class=\"wp-image-70513\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\/w=1271,fit=scale-down 1271w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare_s-change-nameservers-instruction.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1271px) 100vw, 1271px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The nameserver update can take up to 24 hours to complete. Once Cloudflare detects the correct configuration, your domain&#8217;s status will change to <strong>Active<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t delete or change the DNS records you verified in the previous step while waiting for activation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After Cloudflare becomes active, continue with the SSL\/TLS configuration to secure connections between your visitors, Cloudflare, and your WordPress server.<\/p>\n\n\n\n<h2 id=\"h-5-configure-ssl-tls-and-https-settings\" class=\"wp-block-heading h-t-title-2\">5. Configure SSL\/TLS and HTTPS settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cloudflare&#8217;s SSL\/TLS settings determine how traffic is encrypted between visitors, Cloudflare, and your WordPress hosting server. For secure connections throughout, use <strong>Full (strict)<\/strong> mode when your hosting server has a valid SSL certificate.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before changing these settings, confirm that your hosting provider has installed an active SSL certificate for your domain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then follow these steps:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open the Cloudflare dashboard and select your WordPress domain.<\/li>\n\n\n\n<li>Navigate to SSL\/TLS \u2192 Overview.<\/li>\n\n\n\n<li>Choose Full (strict) as the encryption mode. This option encrypts connections between visitors, Cloudflare, and your origin server while validating the origin certificate.<\/li>\n\n\n\n<li>Navigate to SSL\/TLS \u2192 Edge Certificates.<\/li>\n\n\n\n<li>Once your edge certificate is active, enable Always Use HTTPS if you want Cloudflare to redirect HTTP requests to HTTPS. Check for existing redirects to avoid conflicts.<\/li>\n\n\n\n<li>Open your WordPress website and admin dashboard using HTTPS to confirm that both load correctly.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Avoid using Flexible mode for a typical WordPress installation. It doesn&#8217;t encrypt the connection between Cloudflare and your hosting server and can cause redirect loops when your origin server forces HTTPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Full (strict) produces an SSL error, verify that your origin server has a valid, correctly configured certificate rather than switching to Flexible mode as a workaround.<\/p>\n\n\n\n<h2 id=\"h-6-install-and-connect-the-cloudflare-wordpress-plugin\" class=\"wp-block-heading h-t-title-2\">6. Install and connect the Cloudflare WordPress plugin<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The official Cloudflare WordPress plugin lets you manage Cloudflare settings and clear cached content directly from your WordPress dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The plugin is optional for basic CDN functionality, but it&#8217;s useful for cache management and for enabling Automatic Platform Optimization (APO), which can cache eligible WordPress HTML pages at Cloudflare&#8217;s edge.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To connect the plugin, first install it on your website:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open your WordPress dashboard.<\/li>\n\n\n\n<li>Navigate to Plugins \u2192 Add New Plugin.<\/li>\n\n\n\n<li>Search for Cloudflare.<\/li>\n\n\n\n<li>Install and activate the official <a data-click-id=\"hgr-post-content-link-cloudflare-plugin\" href=\"https:\/\/wordpress.org\/plugins\/cloudflare\/\" target=\"_blank\" rel=\"noopener\">Cloudflare plugin<\/a>.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-wordpress-cloud\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\"><img decoding=\"async\" width=\"1391\" height=\"755\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\/w=1024,h=1024,fit=scale-down\" alt=\"WordPress Cloudflare plugin\n\" class=\"wp-image-70519\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\/w=1391,fit=scale-down 1391w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-plugin.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1391px) 100vw, 1391px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Next, create an API token for your website:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Sign in to Cloudflare and open your account&#8217;s API Tokens page.<\/li>\n\n\n\n<li>Click Create Token.<\/li>\n\n\n\n<li>Find the WordPress template and select Use template.<\/li>\n\n\n\n<li>Review the permissions and select Continue to summary.<\/li>\n\n\n\n<li>Click Create Token and copy the generated token.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-cloudflare-to-g\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\"><img decoding=\"async\" width=\"1273\" height=\"731\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\/w=1024,h=1024,fit=scale-down\" alt=\"Cloudflare to get global API key\n\" class=\"wp-image-70518\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\/w=1273,fit=scale-down 1273w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/Cloudflare-to-get-global-API-key.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1273px) 100vw, 1273px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Return to WordPress and connect your account:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open the Cloudflare plugin&#8217;s Settings page.<\/li>\n\n\n\n<li>Choose the option to sign in with an existing account.<\/li>\n\n\n\n<li>Enter your Cloudflare account email address and paste the API token.<\/li>\n\n\n\n<li>Click Save API Credentials to complete the connection.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-tutorials-wp-content-uploads-sites-2-2017-01-wordpress-cloud-2\" href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\"><img decoding=\"async\" width=\"1294\" height=\"672\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\/w=1024,h=1024,fit=scale-down\" alt=\"WordPress Cloudflare settings, featuring the Enter Cloudflare API credentials window\" class=\"wp-image-70523\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\/w=1294,fit=scale-down 1294w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/01\/WordPress-Cloudflare-add-API-key.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1294px) 100vw, 1294px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Once connected, you can review Cloudflare&#8217;s recommended WordPress settings and purge cached content after making website changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to enable APO, check whether it&#8217;s included in your Cloudflare plan or available as an add-on. APO can improve delivery of eligible WordPress HTML pages, but it isn&#8217;t necessary for standard CDN caching.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Important:<\/strong> If you use another caching plugin, test compatibility before enabling additional Cloudflare caching features. Multiple caching layers can cause outdated content or unexpected behavior.<\/p>\n\n\n\n<h2 id=\"h-7-verify-cloudflare-is-working\" class=\"wp-block-heading h-t-title-2\">7. Verify Cloudflare is working<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After completing the setup, verify that Cloudflare is active and your WordPress website works correctly.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open your domain in Cloudflare and confirm that its status is Active.<\/li>\n\n\n\n<li>Navigate to DNS \u2192 Records and verify that the website&#8217;s relevant A, AAAA, or CNAME records have the orange Proxied status.<\/li>\n\n\n\n<li>Visit your WordPress website using HTTPS and confirm that it loads without certificate warnings or redirect errors.<\/li>\n\n\n\n<li>Open your WordPress dashboard and check whether you can log in normally.<\/li>\n\n\n\n<li>Test a few pages, images, and forms to make sure they work correctly.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You can also confirm that website traffic passes through Cloudflare by checking the response headers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open your browser&#8217;s developer tools, navigate to the Network tab, and reload the website. Select the main document request and look for the <code>cf-ray<\/code> response header.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the header appears, the request has passed through Cloudflare&#8217;s network.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You may also see a <code>cf-cache-status<\/code> header, which indicates how Cloudflare handled caching for that request. A cache MISS or DYNAMIC response doesn&#8217;t necessarily mean the CDN is configured incorrectly, since Cloudflare doesn&#8217;t cache all content by default.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the website works correctly, you can review additional performance and security settings.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a data-click-id=\"hgr-post-content-link-wordpress-hosting\" class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/wordpress-hosting\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"2048\" height=\"600\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"Hostinger managed WordPress hosting banner with a Get Started button, recommended by WordPress.org\" class=\"wp-image-111781\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1536,fit=scale-down 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure>\n\n\n\n<h2 id=\"h-what-are-the-recommended-cloudflare-settings-for-wordpress\" class=\"wp-block-heading h-t-title-2\">What are the recommended Cloudflare settings for WordPress?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For most WordPress websites, Cloudflare&#8217;s default caching and security features provide a good starting point. You don&#8217;t need to enable every optimization option to benefit from the CDN.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following settings offer a balance between performance, security, and compatibility.<\/p>\n\n\n\n<figure tabindex=\"0\" class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>Setting<\/th><th>Recommendation<\/th><th>Why<\/th><\/tr><tr><td>SSL\/TLS encryption<\/td><td>Full (strict)<\/td><td>Encrypts traffic between visitors, Cloudflare, and your hosting server while validating the origin certificate<\/td><\/tr><tr><td>Always Use HTTPS<\/td><td>Enable after confirming SSL works<\/td><td>Redirects HTTP requests to HTTPS<\/td><\/tr><tr><td>DNS proxy<\/td><td>Proxied for website traffic<\/td><td>Routes eligible website requests through Cloudflare&#8217;s CDN and security features<\/td><\/tr><tr><td>Caching<\/td><td>Keep default behavior initially<\/td><td>Cloudflare automatically caches eligible static assets, including images, CSS, and JavaScript<\/td><\/tr><tr><td>Cache Rules<\/td><td>Configure only when needed<\/td><td>Provides more control over caching specific URLs and content types<\/td><\/tr><tr><td>WordPress APO<\/td><td>Optional<\/td><td>Can improve delivery of eligible WordPress HTML pages through edge caching<\/td><\/tr><tr><td>Web Application Firewall (WAF)<\/td><td>Keep available managed protections enabled<\/td><td>Helps protect against common web attacks<\/td><\/tr><tr><td>Rocket Loader<\/td><td>Leave disabled initially<\/td><td>JavaScript optimization can cause compatibility problems with some themes and plugins<\/td><\/tr><tr><td>Compression<\/td><td>Use Cloudflare defaults<\/td><td>Cloudflare automatically applies supported compression methods<\/td><\/tr><tr><td>Development Mode<\/td><td>Enable temporarily when troubleshooting<\/td><td>Helps test changes by bypassing Cloudflare&#8217;s edge cache<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading h-t-title-3\">How should you configure Cloudflare caching for WordPress?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Cloudflare automatically caches eligible static resources, such as images, CSS, and JavaScript. However, it doesn&#8217;t cache HTML pages by default.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to cache WordPress pages, consider Automatic Platform Optimization or carefully configured Cache Rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Avoid applying a universal Cache Everything rule<\/strong> without accounting for logged-in users and dynamic content. WordPress admin pages, shopping carts, checkout pages, and other personalized content may need to bypass caching.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you make changes to your website but still see outdated content, purge the affected URLs from Cloudflare&#8217;s cache. You can manage this through the Cloudflare dashboard or the connected WordPress plugin.<\/p>\n\n\n\n<h3 class=\"wp-block-heading h-t-title-3\">Should you enable additional performance features?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Features such as Rocket Loader and image optimization may improve performance for some WordPress websites, but their benefits depend on the website&#8217;s configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Test additional optimizations one at a time. Check that your theme, navigation, forms, and interactive features continue working before keeping a new setting enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For most beginners, correctly configuring DNS, HTTPS, caching, and basic security is more important than enabling every available performance feature.<\/p>\n\n\n\n<h2 id=\"h-how-to-troubleshoot-common-cloudflare-errors\" class=\"wp-block-heading h-t-title-2\">How to troubleshoot common Cloudflare errors<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If your WordPress website stops working after setting up Cloudflare, the problem may involve DNS configuration, SSL\/TLS settings, or communication with your hosting server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are three common Cloudflare errors and what to check first.<\/p>\n\n\n\n<figure tabindex=\"0\" class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>Error<\/th><th>Meaning<\/th><th>What to check<\/th><\/tr><tr><td>520 \u2013 Web server returns an unknown error<\/td><td>The origin server returned an empty, malformed, or unexpected response<\/td><td>Review server error logs, security plugins, and server configuration<\/td><\/tr><tr><td>521 \u2013 Web server is down<\/td><td>The origin server refused Cloudflare&#8217;s connection<\/td><td>Confirm the server is running and isn&#8217;t blocking Cloudflare IP addresses<\/td><\/tr><tr><td>522 \u2013 Connection timed out<\/td><td>Cloudflare couldn&#8217;t establish or complete a connection to the origin in time<\/td><td>Check server availability, firewall rules, resource usage, and the origin IP address<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Start by confirming that your hosting server is online and that Cloudflare&#8217;s DNS records point to the correct destination.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the problem persists, check the server&#8217;s error logs and firewall configuration. Avoid disabling security features or modifying server files without identifying the actual cause.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For connection-refused errors, our guide to <a data-click-id=\"hgr-post-content-link-fixing-cloudflare-error-521\" href=\"\/tutorials\/how-to-fix-error-521\/\">fixing Cloudflare error 521<\/a> covers the troubleshooting process in more detail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When contacting your hosting provider, share the error code, affected URL, and time of the incident. If Cloudflare displays a Ray ID, include it to help with the investigation.<\/p>\n\n\n\n<h2 id=\"h-how-to-test-your-wordpress-websites-performance\" class=\"wp-block-heading h-t-title-2\">How to test your WordPress website&#8217;s performance<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After configuring Cloudflare, check whether your WordPress website loads correctly and whether its performance has improved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A CDN can reduce the time needed to deliver cached content, but the results depend on your website&#8217;s location, visitor distribution, caching configuration, and hosting performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To evaluate your setup:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Run a speed test.<\/strong> Use a <a data-click-id=\"hgr-post-content-link-website-speed-testing-tool\" href=\"\/tutorials\/website-speed-test\/\">website speed testing tool<\/a> to measure loading performance and identify slow resources.<\/li>\n\n\n\n<li><strong>Review caching behavior.<\/strong> Confirm that Cloudflare caches eligible static resources and that dynamic pages continue working correctly.<\/li>\n\n\n\n<li><strong>Optimize your WordPress website.<\/strong> Combine Cloudflare with other <a data-click-id=\"hgr-post-content-link-wordpress-performance-improvements\" href=\"\/tutorials\/speed-up-wordpress\/\">WordPress performance improvements<\/a>, such as image optimization, efficient themes, and plugin maintenance.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Make one optimization at a time and compare the results. This will help you understand which changes improve your website without introducing unnecessary compatibility issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cloudflare improves WordPress website performance and security through its content delivery network (CDN), caching, DDoS protection, and SSL\/TLS features. To [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/how-to-setup-cloudflare-for-wordpress\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":183,"featured_media":83872,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to set up Cloudflare for WordPress (7 steps)","rank_math_description":"Learn how to set up Cloudflare for WordPress in 7 steps. Configure DNS, SSL\/TLS, caching, and recommended settings to improve website speed and security.","rank_math_focus_keyword":"wordpress cloudflare","_content_updated_date":"2022-11-24","footnotes":""},"categories":[22640,22637],"tags":[],"class_list":["post-735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security-and-maintenance","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/cdn-cloudflare\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/comment-integrer-cloudflare-a-wordpress\/","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/como-configurar-cloudflare-en-wordpress\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-setting-cloudflare\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-setup-cloudflare-for-wordpress","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-configurar-cloudflare-en-wordpress\/","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/como-configurar-cloudflare-en-wordpress\/","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/como-configurar-cloudflare-en-wordpress\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/cdn-cloudflare\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/183"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=735"}],"version-history":[{"count":53,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/735\/revisions"}],"predecessor-version":[{"id":160194,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/735\/revisions\/160194"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/83872"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}