Cloudflare Api Page Rule failed validation

Hey,

I’ m trying to add a page rule using Cloudflare API but I cant managed it to work. What I’m trying is basically create a rule that will manage caches by page status code. I’m also sharing json file I use to do this. Can you guys help :slight_smile:

{

"targets": [

  {

    "target": "url",

    "constraint": {

      "operator": "matches",

      "value": "portal.dev.example.com/*"

    }

  }

],

"actions": [

  {

    "id": "cache_ttl_by_status",

    "value": {

      "200": 86400

    }

  }

],

"priority": 1,

"status": "active"

}

Error I get :

{“success”:false,“errors”:[{“code”:1004,“message”:“Page Rule validation failed: See messages for details.”}],“messages”:[{“code”:1,“message”:".settings[0]: Invalid setting cache_ttl_by_status",“type”:null}],“result”:null}Preformatted text

Are you on an Enterprise plan?

nope is it only available for Enterprise plan users ?

Correct. Enterprise Only.

https://developers.cloudflare.com/cache/how-to/configure-cache-status-code#set-cache-ttl-by-response-status-via-the-cloudflare-dashboard

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.