How to Disable Cloudflare APO

I had the Cloudflare APO (they call it Automatic Platform Optimization) installed on a website for a few months, it was working all right. But then I enabled ads on the site, and they were not being shown due to APO’s powerful caching.

I was advised to disable the Cloudflare APO thing on my site, and it’s mentioned nowhere how to “completely” disable it. Yes, you can directly uninstall the Cloudflare WordPress plugin, but it still keeps working, as it happened to me and to others.

Cloudflare APO Disabling

After spending 3 days finding solutions, I finally know how to completely disable Cloudflare APO from your website. Let me explain, step by step…

1. Prepare the command

First, copy-paste the below command to a plaintext file on your computer, and replace all the variables indicated inside {}.

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/{CF_ZONE_ID}/settings/automatic_platform_optimization" -H "X-Auth-Email: {CF_EMAIL}" -H "X-Auth-Key: {CF_GLOBAL_API_KEY}" -H "Content-Type: application/json" --data '{"value":{"enabled":false}}'

{CF_ZONE_ID}

Replace {CF_ZONE_ID} with the Zone ID of the added website in the command that you copied-pasted above.

You can get the Zone ID on the right side when you open a site in Cloudflare, as shown in the above screenshot.

{CF_EMAIL}

Replace {CF_EMAIL} with the email that you have used for creating your Cloudflare account.

Cloudflare account email

If you don’t remember, you can find the email after clicking on the profile icon in the top-right corner, as it appears in the above screenshot.

{CF_GLOBAL_API_KEY}

Now, replace {CF_GLOBAL_API_KEY} with the Global API Key of your Cloudflare account.

Cloudflare Global API

You can get the Global API Key from Profile > API Tokens as shown in the screenshot above. After you click on the View button, you may need to enter your account password in order to see the API key.

Make sure to keep your API key very safe and do not share with anyone else; otherwise, others can get access to your account and make unwanted changes.

Your command is now ready! Let’s move to the next step.

2. Run the command

Open the terminal on your computer, copy-paste the plaintext command in the terminal, and hit enter.

And you should see an output like this in the terminal:

{
  "result": {
    "id": "automatic_platform_optimization",
    "editable": true,
    "value": {
      "cf": false,
      "enabled": false,
      "wordpress": false,
      "wp_plugin": false,
      "hostnames": [
        "yourwebsite.com",
        "www.yourwebsite.com"
      ],
      "cache_by_device_type": false
    },
    "modified_on": null
  },
  "success": true,
  "errors": [],
  "messages": []
}

It means the Cloudflare APO has been successfully disabled for your website. And after it gets disabled, you should also clear all cache by clicking on the Purge Everything button under Caching > Configuration of your site in Cloudflare.

Purge Everything Cache on Clouflare

That’s it.

Hope this helps!


Recent Posts

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *