• Resolved zesty1

    (@zesty1)


    I have authenticated with the API Token method.

    i added all these for the appropriate zone:

    Account – Account Settings – Read
    Account – Worker Scripts – Edit
    Zone – Cache Purge – Purge
    Zone – Page Rules – Edit
    Zone – Zone Settings – Edit
    Zone – Zone – Edit
    Zone – Worker Routes – Edit

    When I hit “enable cache” it actually says sucessfully updated with a green checkmark.

    When i log into cloudflare, there are no cache rules OR page rules. Very clearly it was not successful as no rule got created

    This is what the log file says… so the first problem is that it reports this as ‘success’ when its clearly not success. secondly, i just need it to work:

    [2024-08-11 19:50:06] [cloudflare::try_log_error] Cloudflare API Errors: Authentication error (err code: 10000)
    [2024-08-11 19:50:08] [cloudflare::create_ruleset_id] Could NOT create rulesets ID for zone xxxxx – URL: https://api.cloudflare.com/client/v4/zones/xxxxx/rulesets
    [2024-08-11 19:50:08] [cloudflare::try_log_error] Cloudflare API Errors: Authentication error (err code: 10000)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    You also need to give access to Zone – Cache Rules – Edit in your authentication token.

    Hi iSaumya,

    Since the deprecation of Cloudflare page rules, is this still the best practice:
    https://gist.github.com/isaumya/af10e4855ac83156cc210b7148135fa2

    Since you seem to be the expert, I just want to know what is best practice based on your opinion. We use these settings on one of our sites currently, so I wanted to know how setting the plugin this way compares to the “auto config” of just adding the plugin and letting it do the work.

    Lastly, the API token settings don’t seem to be working anymore as I am getting an error code in the plugin that says:

    • Cloudflare (Cache Rule or Worker) is not enabled!
    • Disk Page Caching is functional.

    I was using these settings:

    Account – Account Settings – Read
    Account – Worker Scripts – Edit
    Zone – Cache Purge – Purge
    Zone – Page Rules – Edit
    Zone – Zone Settings – Edit
    Zone – Zone – Edit
    Zone – Worker Routes – Edit

    Right now it doesn’t seem that the plugin is working on multiple sites that I have the API Token setup since the plugin updated. How do I fix this issue?

    Thank you for your time, I greatly appreciate it.

    Best regards,

    Scott

    Plugin Support Ionut Neagu

    (@ionutn)

    Hey Scott,

    I can see that you didn’t gave Cache Rules edit rights to the token, so it won’t work. You can see more info in the logs.

    Regarding the rule, I suggest you do not edit the rule that the plugin create, since for e.g in the next version we’ll update this automatically. If you want to make edits, I recommend creating a different cache rule yourself.

    Thank you Ionut for your reply! For the API tokens, are all the zone and Account settings still applicable or does the plugin no longer need Zone-Page Rules, Zone Worker Routes and Scripts, Zone, etc.? The plugin use to have the rules needed to setup the API token, however, it seems that has been removed.

    Account – Account Settings – Read
    Account – Worker Scripts – Edit
    Zone – Cache Purge – Purge
    Zone- Cache Rules- Edit
    Zone – Page Rules – Edit
    Zone – Zone Settings – Edit
    Zone – Zone – Edit
    Zone – Worker Routes – Edit

    If you can please provide and updated API Token setup as this will help users of the plugin, it would be greatly appreciated.

    Thank you for your time,
    Scott

    Plugin Contributor iSaumya

    (@isaumya)

    Scott,
    Your API Token Permission looks good to me. If you are using Cache Rules you really don’t need to use Worker.

    Thank you iSaumya for your reply!

    I’m still trying to finout out how to create an API token using the simplest settings possible. I’m created the API Token using the previous settings that were suggested when there were “Page Rules”, so now what is the fewest amount of settings needed to create an API Token for the Super Page Cache Plugin.

    Is it possible to get it listed somewhere in the plugin itself like the plugin use to have? Or, can you just list the simplest settings for API Token since certain things aren’t needed anymore.

    I would really appreciate it.

    Thanks,
    Scott

    Let me add my own request to Scott’s, five months later!

    In my case, besides having exactly the problem described, things are a bit more sneaky. Although I have done experiments on a “fresh install” of Super Page Cache, the results were more confusing than enlightening.

    I generated a new API key for the new website, and added all Edit permissions I could toggle (a few are read-only) — which took me 15 minutes or more (!). Then I connected to Cloudflare from the SPC plugin. OK, that worked fine. Next step: testing the connection. All failed — both for Cloudflare and the local Page Cache (!!). But it still showed Cloudflare as being “connected” — just not enabled (the plugin comes with disabled as default).

    So — I clicked on enable!

    As reported, that gives the usual 10000 or 9901 codes. Testing the connection again from the plugin, I get precisely the same result.

    However… the “enabled” button… stayed on!

    Now, that was a first. Usually, as soon as the plugin detects that something is wrong, it (correctly) returns to the disabled status. This didn’t happen this time!

    I proceeded to investigate further. Using now curl from the command line, I investigated the headers. The first request (as expected) returned a MISS from both Cloudflare and the Page Cache. However, after 2-3 tries, both Cloudflare and the Page Cache (!) included their headers with a HIT! (Note: there is one header placed by Cloudflare; another by the SPC plugin; both have returned a HIT.)

    Returning to the SPC plugin’s dashboard, I tried to do a new test. Once again, it failed for both Cloudflare and the Page Cache — but, for some reason, it stayed enabled. Good for me, because now I could test with other pages, images being served or JS/CSS, etc. All of these worked and were being cached — according to the headers.

    I’m going to replicate this on a test site I’ve got, starting from scratch, and which I can give you all access to do your own testing. Let’s just see if I can replicate the same experience. Note that this only happened with a site that never used SPC before, and with a new key. All other sites with an existing SPC installation, even with a new, more permissive API key, continue to exhibit the problem here as initially reported.

    Also note that even the fresh, clean, brand new installation did give the same errors as all the other sites. The difference is that it kept the connection to Cloudflare enabled, and, incidentally, the Page Cache seems to be happy as well.

    I wonder if this has something to do with my recent upgrade to PHP 8.4 under nginx. That was perhaps the most important change that I made on that bare metal server, which is fully managed by me, and so there cannot be any “surprises” in it which haven’t been installed by myself 🙂 That’s the only way I have to know that the actual infrastructure stack is not interfering with anything…

    Plugin Support Kush

    (@kushnamdev)

    Hi @gwynethllewelyn,

    Thank you for your input.

    If you’re experiencing a similar issue as Scott, we kindly request that you create a new support thread. This helps us keep the forum organized and allows us to provide focused assistance for each user.

    You’re welcome to reference this thread in your new post if the issues are related, but for effective support, we appreciate having a dedicated thread for your specific case.

    Thank you for your understanding.

    Best regards,

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Page/Cache Rules not getting created’ is closed to new replies.