{"id":2093,"date":"2026-11-08T00:13:11","date_gmt":"2026-11-08T05:13:11","guid":{"rendered":"https:\/\/websitepsychiatrist.com\/?p=2093"},"modified":"2026-11-08T00:14:16","modified_gmt":"2026-11-08T05:14:16","slug":"wordfence-scheduled-scans-failing-check-your-wordpress-http-and-https-settings","status":"publish","type":"post","link":"https:\/\/websitepsychiatrist.com\/wordfence-scheduled-scans-failing-check-your-wordpress-http-and-https-settings\/","title":{"rendered":"Wordfence Scheduled Scans Failing? Check Your WordPress HTTP and HTTPS Settings"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>An HTTP-to-HTTPS redirect can prevent Wordfence&#8217;s nonblocking scan-launch requests from reaching WordPress, even when the website itself works perfectly.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Wordfence scheduled scans aren&#8217;t starting reliably, but manual scans work, the problem may have nothing to do with your WordPress cron schedule or firewall settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One easily overlooked cause is a mismatch between the URL scheme configured in WordPress and the protocol your website actually uses.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Specifically, <strong>WordPress may still be configured with<\/strong> <code><strong>http:\/\/<\/strong><\/code> <strong>URLs even though the website operates exclusively over HTTPS.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That configuration can prevent Wordfence&#8217;s asynchronous scan-launch requests from reaching their destination.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Wordfence Starts a Scan<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wordfence uses WordPress&#8217;s AJAX endpoint for portions of its scanning process:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/wp-admin\/admin-ajax.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">One of the actions involved in initiating a scan is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>action=wordfence_doScan<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the Wordfence scan engine, the scan-launch URL is constructed using WordPress&#8217;s <code>admin_url()<\/code> function.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The relevant logic is equivalent to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cronURL = admin_url('admin-ajax.php')\n    . '?action=wordfence_doScan'\n    . '&amp;isFork=...'\n    . '&amp;scanMode=...'\n    . '&amp;cronKey=...';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Wordfence also applies its own request-signing mechanism to authenticate the scan-launch request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The important part is the use of <code>admin_url()<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress determines the scheme of that URL from its configuration and the current execution context.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the configured WordPress URL uses HTTP, the generated AJAX URL may also use HTTP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;example.com\/wp-admin\/admin-ajax.php?action=wordfence_doScan<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Even when the public website is accessed exclusively through HTTPS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why an HTTP-to-HTTPS Redirect Can Break the Request<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wordfence can launch scan operations using WordPress&#8217;s HTTP API with a nonblocking request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The relevant request parameters include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$response = wp_remote_get($cronURL, array(\n    'timeout'   =&gt; 0.01,\n    'blocking'  =&gt; false,\n    'sslverify' =&gt; false,\n    'headers'   =&gt; $headers,\n));<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Notice two settings:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>blocking => false<\/code><\/li>\n\n\n\n<li><code>timeout => 0.01<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Wordfence is dispatching the request asynchronously rather than waiting for a complete HTTP response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is an intentional design choice. It allows Wordfence to initiate work without keeping the original PHP process waiting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, it has an important consequence when the requested URL returns a redirect.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Suppose WordPress generates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;example.com\/wp-admin\/admin-ajax.php?action=wordfence_doScan<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">But Cloudflare or the web server enforces HTTPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The HTTP request receives:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 301 Moved Permanently\nLocation: https:\/\/example.com\/wp-admin\/admin-ajax.php?action=wordfence_doScan<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An ordinary blocking HTTP client can follow that redirect.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A nonblocking request, however, may terminate before following it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a result, the intended scan-launch request never reaches the WordPress AJAX handler.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Wordfence attempts to start the scan, but the request responsible for initiating it doesn&#8217;t execute on the origin server.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This can produce repeated scan-start failures or unsuccessful attempts to resume scanning.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The specific behavior depends on the HTTP transport, Wordfence version, and server configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Manual Scans May Still Work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">One confusing symptom is that manually initiated scans may work while scheduled scans fail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That doesn&#8217;t necessarily mean WordPress cron is broken.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Manual and scheduled scan initiation can involve different execution contexts, request sequences, and URL-generation behavior.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In particular, WordPress may detect HTTPS correctly during an administrative browser request while generating an HTTP URL during a background cron process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Consequently, a successful manual scan doesn&#8217;t establish that the scheduled scan-launch request is being generated or delivered correctly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The relevant question is:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What exact URL does Wordfence generate when a scheduled scan attempts to start?<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Diagnose the WordPress URL Configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Start by inspecting the two WordPress URL options.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using WP-CLI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wp option get home\nwp option get siteurl<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For a website operating over HTTPS, the expected results are ordinarily:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;example.com\nhttps:\/\/example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If either value begins with <code>http:\/\/<\/code>, investigate the mismatch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also inspect the actual URLs generated by WordPress:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wp eval '\necho \"Home: \" . home_url() . \"\\n\";\necho \"Site: \" . site_url() . \"\\n\";\necho \"Admin AJAX: \" . admin_url(\"admin-ajax.php\") . \"\\n\";\n'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pay particular attention to the <code>Admin AJAX<\/code> result.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If it shows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;example.com\/wp-admin\/admin-ajax.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">when the website requires HTTPS, Wordfence may be attempting to contact the wrong URL scheme.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is especially relevant when the command runs in a CLI or cron context, where WordPress might not detect an HTTPS web request.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Confirm the Redirect Behavior<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can inspect the HTTP response with <code>curl<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sSI \\\n  http:&#47;&#47;example.com\/wp-admin\/admin-ajax.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If HTTPS redirection is enforced, the response may include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 301 Moved Permanently\nLocation: https:\/\/example.com\/wp-admin\/admin-ajax.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That response establishes that an HTTP request encounters a redirect before reaching the HTTPS endpoint.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It doesn&#8217;t, by itself, prove that Wordfence&#8217;s scan request is failing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For stronger evidence, compare the generated AJAX URL with your Nginx or Apache access logs during a scheduled scan attempt.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the scan launcher is using HTTP and the origin server never receives the expected <code>wordfence_doScan<\/code> request, the redirect may be interrupting the nonblocking request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Be aware that a reverse proxy or Cloudflare can handle the redirect before the request reaches the origin. In that case, the origin access log won&#8217;t contain the initial HTTP request.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fix the WordPress Home and Site URLs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If HTTPS is configured correctly for the website, update the WordPress options:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wp option update home 'https:\/\/example.com'\nwp option update siteurl 'https:\/\/example.com'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the site&#8217;s actual hostname and preserve any legitimate subdirectory paths.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The two settings are distinct:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>home<\/code> defines the address of the public website.<\/li>\n\n\n\n<li><code>siteurl<\/code> defines the location of the WordPress application files.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">They don&#8217;t necessarily have identical paths on every installation, so don&#8217;t blindly overwrite both with the same value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The essential correction is to change the URL scheme from HTTP to HTTPS without altering the intended hostname or path.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once corrected, check the generated AJAX URL again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wp eval '\necho admin_url(\"admin-ajax.php\") . \"\\n\";\n'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It should use HTTPS directly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This removes the unnecessary redirect from the scan-launch request path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Check for WP_HOME and WP_SITEURL Overrides<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress also supports defining its URLs directly in <code>wp-config.php<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('WP_HOME', 'http:\/\/example.com');\ndefine('WP_SITEURL', 'http:\/\/example.com');<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These constants override the corresponding values retrieved from the WordPress options table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, changing the database options may not correct the effective URLs if these constants remain defined with HTTP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check <code>wp-config.php<\/code> for either constant.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a correctly configured HTTPS installation, the definitions should use HTTPS:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('WP_HOME', 'https:\/\/example.com');\ndefine('WP_SITEURL', 'https:\/\/example.com');<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you use environment variables or another mechanism to populate these constants, correct the underlying configuration source.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What If the URLs Are Already HTTPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An HTTP-to-HTTPS mismatch is only one possible cause of failed scheduled scans.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If WordPress generates the correct HTTPS AJAX URL, investigate other potential causes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>WordPress cron execution failures or missed scheduled events.<\/li>\n\n\n\n<li>Cloudflare WAF challenges affecting <code>admin-ajax.php<\/code>.<\/li>\n\n\n\n<li>Security rules blocking authenticated Wordfence scan-launch requests.<\/li>\n\n\n\n<li>PHP timeouts or resource exhaustion.<\/li>\n\n\n\n<li>Requests that fail to reach the origin server.<\/li>\n\n\n\n<li>Wordfence scan errors or invalid request signatures.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t disable firewall protections or relax Wordfence authentication simply to make scheduled scans start.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First determine whether the scan-launch request is reaching WordPress, and if not, identify where it stops.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why the Correct HTTPS Configuration Matters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This issue isn&#8217;t limited to Wordfence.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress and its plugins regularly generate internal URLs for background tasks, asynchronous operations, REST API requests, and other integrations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A browser can make a website look perfectly healthy because browsers generally follow HTTP-to-HTTPS redirects automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Background HTTP clients don&#8217;t always behave the same way.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A working HTTPS redirect does not mean WordPress is correctly configured for HTTPS.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For websites that operate exclusively over HTTPS, both the effective WordPress URL settings and the URLs generated for internal requests should use HTTPS directly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Wordfence manual scans work but scheduled scans repeatedly fail, checking those generated URLs is a useful early diagnostic step.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The difference between <code>http:\/\/<\/code> and <code>https:\/\/<\/code> may be all it takes to prevent a nonblocking scan request from reaching WordPress.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An HTTP-to-HTTPS redirect can prevent Wordfence&#8217;s nonblocking scan-launch requests from reaching WordPress, even when the website itself works perfectly. If Wordfence scheduled scans aren&#8217;t starting reliably, but manual scans work, the problem may have nothing to do with your WordPress cron schedule or firewall settings. One easily overlooked cause is a mismatch between the URL &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Wordfence Scheduled Scans Failing? Check Your WordPress HTTP and HTTPS Settings\" class=\"read-more button\" href=\"https:\/\/websitepsychiatrist.com\/wordfence-scheduled-scans-failing-check-your-wordpress-http-and-https-settings\/#more-2093\" aria-label=\"Read more about Wordfence Scheduled Scans Failing? Check Your WordPress HTTP and HTTPS Settings\">Read more<\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2093","post","type-post","status-publish","format-standard","hentry","category-articles","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/posts\/2093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/comments?post=2093"}],"version-history":[{"count":1,"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/posts\/2093\/revisions"}],"predecessor-version":[{"id":2094,"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/posts\/2093\/revisions\/2094"}],"wp:attachment":[{"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/media?parent=2093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/categories?post=2093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/websitepsychiatrist.com\/api\/wp\/v2\/tags?post=2093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}