Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cloudflare] ERROR: [CLIENT API] Array #266

Closed
janvitos opened this issue Jul 1, 2020 · 5 comments
Closed

[Cloudflare] ERROR: [CLIENT API] Array #266

janvitos opened this issue Jul 1, 2020 · 5 comments

Comments

@janvitos
Copy link
Contributor

janvitos commented Jul 1, 2020

Hi,

I noticed that Cloudflare now throws an error in the nginx error log whenever I publish or update a post.

Here's the exact error log:

2020/07/01 11:43:45 [error] 3849136#3849136: *1285712 FastCGI sent in stderr: "PHP message: [Cloudflare] ERROR: [CLIENT API] Array
(
    [type] => request
    [path] => (hidden)
    [timeout] => 30
    [method] => DELETE
    [headers] => Array
        (
            [Content-Type] => application/json
            [X-Auth-Email] => (hidden)
            [X-Auth-Key] => (hidden)
        )

    [body] => {"files":["https:\/\/www.hidden.com\/sujet\/actualite\/","https:\/\/www.hidden.com\/tag\/bizarre\/","https:\/\/www.hidden.com\/tag\/catastrophe\/","https:\/\/www.hidden.com\/tag\/france\/","https:\/\/www.hidden.com\/tag\/humour\/","https:\/\/www.hidden.com\/tag\/mignon\/","https:\/\/www.hidden.com\/tag\/monde\/","https:\/\/www.hidden.com\/tag\/sante\/","https:\/\/www.hidden.com\/tag\/societe\/","https:\/\/www.hidden.com\/auteur\/hidden\/","https:\/\/www.hidden.com\/auteur\/hidden\/feed\/","https:\/\/www.hidden.com","https:\/\/www.hidden.com?feed=rss2","https:\/\/...PHP message: [Cloudflare] ERROR: [CLIENT API] Array
(
    [type] => response
    [reason] => Bad Request
    [code] => 400
)
 PHP message: [Cloudflare] ERROR: Bad Request PHP message: [Cloudflare] ERROR: [CLIENT API] Array
(
    [type] => request
    [path] => (hidden)
    [timeout] => 30
    [method] => DELETE
    [headers] => Array
        (
            [Content-Type] => application/json
            [X-Auth-Email] => (hidden)
            [X-Auth-Key] => (hidden)
        )

    [body] => {"files":["https:\/\/www.hidden.com\/sujet\/actualite\/","https:\/\/www.hidden.com\/tag\/bizarre\/","https:\/\/www.hidden.com\/tag\/catastrophe\/","https:\/\/www.hidden.com\/tag\/france\/","https:\/\/www.hidden.com\/tag\/humour\/","https:\/\/www.hidden.com\/tag\/mignon\/","https:\/\/www.hidden.com\/tag\/monde\/","https:\/\/www.hidden.com

I have removed my email, website name and auth key from the logs, but I know the values are correct.

Thanks.

@janvitos janvitos closed this as completed Jul 1, 2020
@janvitos janvitos reopened this Jul 1, 2020
@olegcarguy
Copy link

I am seeing this too

@gramorris
Copy link

To add to this....

On the 30th June CF introduced a 30 url limit to purge requests (https://api.cloudflare.com/#zone-purge-files-by-url). Currently the plugin makes no provision for that limit and by and large fails relatively silently. We've put a temporary fix on our sites by removing http urls using the purge filter but in a https site it is relatively easy to hit the 30 purge limit if a post contains 5 or so terms.

@patryk
Copy link
Contributor

patryk commented Jul 2, 2020

Thanks for patience. There was an unfortunate coincidence of two things:

  • Extended number of URLs purged on content update Purge attachment URLs #208
  • Cache team separately reduced number of allowed URLs in single Cache Purge request

Release 3.5.1 contains the fix. Apologies for the trouble! 🙇‍♂️

@mnlgmz
Copy link

mnlgmz commented Jul 3, 2020

Hi,

Thank you so much @gramorris for those details.

What I did to fix this issue is removing or commenting from /public/wp-content/plugins/cloudflare/src/WordPress/Hooks.php on line 236, the following:

// Purge https and http URLs (Line 235)
//if (function_exists('force_ssl_admin') && force_ssl_admin()) {
//    $listofurls = array_merge($listofurls, str_replace('https://', 'http://', $listofurls));
//} elseif (!is_ssl() && function_exists('force_ssl_content') && force_ssl_content()) {
//    $listofurls = array_merge($listofurls, str_replace('http://', 'https://', $listofurls));
//}

NOTE:

  • If the site is using force_ssl_admin, force_ssl_content, or a plugin to redirect HTTP to HTTPS, you probably will need this.

  • If the site is using native HTTPS, you won’t need this at all.

Feeds (Optional):

By default, WordPress comes with some feed types, but the most commonly used is RSS2; therefore, if you are not using RDF, RSS (1.0), or Atom feeds, you can disable them.

// Feeds (Line 217)
array_push(
    $listofurls,
    //get_bloginfo_rss('rdf_url'),
    //get_bloginfo_rss('rss_url'),
    get_bloginfo_rss('rss2_url'),
    //get_bloginfo_rss('atom_url'),
    get_bloginfo_rss('comments_rss2_url'),
    get_post_comments_feed_link($postId)
);

If you are using a third-party comments plugin like Disqus or Spot.IM, you can also disable comments_rss2_url, and also post_comments_feed_link, which is used to track the comments on a specific post.

// Feeds (Line 217)
array_push(
    $listofurls,
    get_bloginfo_rss('rss2_url')
);

Hope that helps,

Cheers.

@janvitos
Copy link
Contributor Author

janvitos commented Jul 3, 2020

I can confirm that the issue is fixed in 3.5.1.

Thanks for the speedy fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants