503 error codes is from WP REST API calls. Also, the Cron doesn't work properly

Dear CF Team,

I am trying to use a plugin called “seraphinite accellerator” as site cache plugin. Within the setup wizzard I am getting many HTTP 503 errors displayed. Their support state this has to do with Cloudflare. If I de-activate Cloudflare, those errors are gone.

The following issues I get at my webshop:

  • 503 error codes is from WP REST API calls.
  • Also, the Cron doesn’t work properly.

Screen shot >

Here are my testing results I made so far…

  • Test when Cloudflare is not activated
  1. CPNgingx is enabled
  2. disabled Cloudflare DNS pointing to our server
    within Cloudflare dashboard, I checked for the domain the DNS settings of Proxy status (DNS only + not proxied) and purged the cache
  3. Checking clone site > Result: No Errors
  4. Checked main site > Result: No Errors

Conclusion: we can admit, that it has not to do with our server

  • Test when Cloudflare is activated
  1. CPNgingx is enabled
  2. enabled back Cloudflare DNS pointing to our server
    within Cloudflare dashboard, I checked for the domain the DNS settings of Proxy status is now back to “proxied” (instead of DNS only) and purged the cache again
  3. Checking clone site > Result: HTTP 503 Errors
  4. Checked main site > Result: HTTP 503 Errors

Conclusion: There is a problem existing when Cloudflare is used

I need your help to solve those issues to be able to proceed.

Best regards, Alex

I’d suggest you to whitelist your origin host / server / hosting IP address by navigating to the Security → WAF → Tools → IP Access Rules with the action “allow” for your Website and try again.

It happens due to the WordPress using HTTP/1.0 and empty user-agent, therefore while executing WP-Cron or some other related JSON/REST API request.

1 Like

Hello Fritex,

thanks for response.

Unfortunately even after adding my own server IPv4 Addresses (2 in use), I stll getting this HTTP 503 error when using the “seraphinite accellerator” plugin setup wizzard.

I just find tipp (How to Fix WP-Cron Not Working Issue with Cloudflare?) and deactivated the " Bot Fight Mode" (CF > Security > Bots), but still I am getting now a HTTP 200 error.

“The response headers must contain ‘X-seraph-accel-prepskip: selfTest’.
HTTP 200”
AND
" External static caching of Cloudflare is active, which can block the display of fresh and optimized pages. In this case, it will be necessary to additionally clear it’s cache.
The response headers must contain ‘X-seraph-accel-test: 1663079055387’.
HTTP 200 "

Any further help is highly appreshiated.

Best regards, Alex

From the screenshot above, I can see your’e using Wordfence too.

May I just ask and share here, to double-check the Wordfence options if they’re correctly set due to the compatibility with Cloudflare proxy mode.

Make sure to correctly configure Wordfence to work with Cloudflare proxy to return the correct visitor IP address under the Global Options - > CF-Connecting-IP from the link below:

Hopefully, the Wordfence plugin isn’t blocking the REST API? Have you tried disabling it? :thinking:

I wonder if the Cloudflare somehow strips that particular HTTP header from the URL :thinking:

Could you check this via cURL?

Is there any other caching plugin for WordPress active?

Kindly, may I ask you to check out what option have you got selected by navigating to the Cloudflare dashboard → Caching → Configuration → find section “Browser Cache TTL” and make sure the selected option from the dropdown menu is “Respect Existing Headers”.

Furthermore, from the same menu, click on the blue button saying “Purge Everything” to flush the cache at Cloudflare Edge, just in case.

Wait for a minute or two.

Refresh a page in your Web browser, otherwise try clearing your Web browser cache or use a different Web browser to test out again.

I have to admit I haven’t used this plugin yet, therefore not familiar much with which options you’ve got :thinking:

May I ask have you tried writing to the support of that plugin how to configure it while using Cloudflare? :thinking:

Hello fritex,
many thanks for these valuable informations.

I found out the following:

  1. wordfence
    In the settings of the genreal wordfende options the “Use the Cloudflare “CF-Connecting-IP” HTTP header to get a visitor IP. Only use if you’re using Cloudflare.” was not set correctly and is now corrected.

  2. Browser Cache TTL
    16 Days is set

  3. Purge Cache + Browser Cache
    within Cloudflare “Purge Everything”
    within chrome "cookies deleted

Done

  1. Test again with different browser
    Result: I often get now a HTTP 520 Error

Checking the task scheduler (Cron) for execution : Failed
HTTP 520 (MyDomain)?_=16631394886841
Response headers
date: Wed, 14 Sep 2022 07:11:28 GMT
content-type: text/html; charset=UTF-8
set-cookie: cf_use_ob=0; path=/; expires=Wed, 14-Sep-22 07:11:58 GMT
x-frame-options: SAMEORIGIN
referrer-policy: same-origin
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
cf-ray: 74a74f0c6e019b69-FRA
server: Cloudflare

Do you have any further suggestions?
Best regards, Alex

P.S. I’ve also set now a cronjob for the “wp-cron.php” according the conjob advice stated above.

Thank you for feedback information.

What I think would cause the issue, but hm…

Now you get another different error :thinking:

I am trying to connect the dots because, as if it’s related to the WordPress or Cloudflare itself somehow, lately there were two topics on which users got 520 while trying to access some WP file which shouldn’t throw 520 at all while the rest of the WP is working fine.

Hello again,
thanks for the 520 tips.

FYI:

  • the Cloudflare IP’s are already saved in server firewall allow list
  • CF setting “Always Online” is still set as inactive

In the debug.log I found an database error related to the WPML translation plugin.
Maybe this causes the HTTP 520 errors.

WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘-1’ at line 36 for query
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) JOIN wp_icl_translations wpml_translations
ON wp_posts.ID = wpml_translations.element_id
AND wpml_translations.element_type = CONCAT(‘post_’, wp_posts.post_type)
WHERE 1=1 AND wp_posts.ID IN (10656,8392,8392,8392,8392,8773,24797,8392,24869,10595,10856,10945,8365,8365,8365,8392,8392,8392,8392,8392,8392,11735,11735,11735,11735,8365,8392,8392,8392,8392,24797,8567,24797,8584,9268,8607,8607,8607,8607,24797,8392,24797,8678,8678,8678,24791,8607,8607,8607,8392,8392,8392,8392,8392,8392,8392,8607,8392,8392,8392,8392,8392,8392,8392,8724,8607,8607,8607,25134,24797,8773,8773,24797,8802,8820,8987,8987,8915,24797,8947,24797,9188,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,24797,8987,8987,24797,9104,9104,8987,9150,9104,9188,24797,8987,9220,9253,9268,8987,8773,8724,8724,24797,8987,8756,25013,25044,9335,24797,11706,8392,10205,8285,8285,8285,8584,24797,8567,8915,24797,10656,10656,10656,10656,10656,10725,10725,10725,10725,10725,10725,10725,10725,24857,10656,10656,10788,24797,24857,24864,10788,24864,10788,24797,10908,10887,8392,10418,24797,6667,11706,11735,11735,11735,11735,11735,11735,11735,11735,11735,11735,11735,8607,12940,24869,11735,11735,12193,12193,24797,9220,24869,24788,11706,8584,9335,9335,12752,12752,12752,12752,12752,12752,12752,12752,12752,12752,12752,12752,8678,24869,24797,24797,8392,24869,8987,24791,12940,24797,10945,10945,8607,24869,24860,10725,10725,10725,10725,10656,10656,24852,10656,10656,24864,10595,10595,10595,24857,9268,8987,9253,9220,9220,9188,9188,9150,9104,24797,24797,8947,24869,12752,12752,12752,12752,12752,12752,24869,24869,10788,24797,24797,24797,24797,24797,24797,24797,24860,11735,11735,8365,8365,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8392,8516,8516,8541,8554,8541,8554,8554,8584,8567,8567,8584,8607,8607,8607,8607,8607,8607,8607,8678,8724,8724,8724,8724,8724,8724,8724,8756,8756,8802,8773,8773,8773,8773,8802,8820,8820,8915,8915,8947,8987,9104,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,24797,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,8987,9104,9104,9104,9104,9104,9104,9104,9104,9150,9150,9150,9150,9188,9188,9220,9220,9220,9253,9253,9306,9268,9268,9268,9268,9268,9319,9306,9306,9335,9319,10400,9335,9335,10418,10418,10595,10595,10595,10595,10656,10656,10656,10656,10656,10656,10656,10656,10656,10656,10656,10656,10725,10725,10725,10725,10725,10725,10725,10725,10725,10725,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10788,10856,10869,10887,10869,10869,10887,10887,10908,10908,10945,11706,24864,11735,11735,11735,11735,11735,12193,12752,24869,12752,12752,12752,12752,12752,12752,12837,12837,12837,24788,25134,24797,8607,24797,24797,24797,24791,24797,8987,24797,24797,24797,24797,24797,24797,24797,10418,24797,24797,24891,24797,24852,24896,24854,24854,10856,24864,11735,24869,24869,24869,24869,24869,24869,24797,24797,24797,24797,24797,24797,24891,24869,24891,24906,24891,24869,24869,24896,24909,24896,24917,24896,24896,24896,24891,24896,24906,24909,24917,24909,24917,24920,24920,24923,24909,24909,24927,24920,24923,24909,24909,24927,24930,24927,24923,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24930,24981,24981,24930,24930,24930,24981,24981,24930,24930,24930,24930,24981,24981,24981,24994,24981,25100,24994,24994,24994,24994,25000,24981,25006,25000,25000,25017,25000,25006,24981,24994,25006,25006,25037,25017,25017,25006,25017,25017,25006,25017,25013,25025,25017,25025,25025,25017,25030,25030,25000,25000,25006,25013,25030,25030,25030,25013,25028,25030,25037,25040,25040,25044,25044,25078,25040,25044,25044,25044,25044,25040,25036,25044,25053,25053,25100,24981,24896,24869,24869,24860,24860,24854,24791,25053,25053,25044,25053,25053,25053,25053,25053,25053,25053,25053,25053,25053,25053,25053,25053,25053,25053,25078,25053,25053,25053,25100,25053,25078,25078,25078,25078,25053,25053,25078,25078,25078,25078,25078,25078,25028,24923,24909,24787,24788,25037,24981,24981,24930,24906,24896,24896,24869,24797,24791,24791,25078,25078,25078,25078,25078,25078,25078,25078,25078,25078,25124,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25100,25121,25121,25121,25127,25131,25127,25124,25124,25127,25127,25131,25131,25134,25134,25138,25138,25138,25167,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25142,25167,25167,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25170,25248,25138,25252,25142,25142,25142,25170,25170,25170,25252,8392,8541,8607,10400,10400,10656,10595,25248,25248) AND (
wp_posts.ID NOT IN (
SELECT object_id
FROM wp_term_relationships
WHERE term_taxonomy_id IN (14)
)
AND …

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