An HTTP-to-HTTPS redirect can prevent Wordfence’s nonblocking scan-launch requests from reaching WordPress, even when the website itself works perfectly.
If Wordfence scheduled scans aren’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 scheme configured in WordPress and the protocol your website actually uses.
Specifically, WordPress may still be configured with http:// URLs even though the website operates exclusively over HTTPS.
That configuration can prevent Wordfence’s asynchronous scan-launch requests from reaching their destination.
How Wordfence Starts a Scan
Wordfence uses WordPress’s AJAX endpoint for portions of its scanning process:
/wp-admin/admin-ajax.php
One of the actions involved in initiating a scan is:
action=wordfence_doScan
In the Wordfence scan engine, the scan-launch URL is constructed using WordPress’s admin_url() function.
The relevant logic is equivalent to:
$cronURL = admin_url('admin-ajax.php')
. '?action=wordfence_doScan'
. '&isFork=...'
. '&scanMode=...'
. '&cronKey=...';
Wordfence also applies its own request-signing mechanism to authenticate the scan-launch request.
The important part is the use of admin_url().
WordPress determines the scheme of that URL from its configuration and the current execution context.
If the configured WordPress URL uses HTTP, the generated AJAX URL may also use HTTP.
For example:
http://example.com/wp-admin/admin-ajax.php?action=wordfence_doScan
Even when the public website is accessed exclusively through HTTPS.
Why an HTTP-to-HTTPS Redirect Can Break the Request
Wordfence can launch scan operations using WordPress’s HTTP API with a nonblocking request.
The relevant request parameters include:
$response = wp_remote_get($cronURL, array(
'timeout' => 0.01,
'blocking' => false,
'sslverify' => false,
'headers' => $headers,
));
Notice two settings:
blocking => falsetimeout => 0.01
Wordfence is dispatching the request asynchronously rather than waiting for a complete HTTP response.
This is an intentional design choice. It allows Wordfence to initiate work without keeping the original PHP process waiting.
However, it has an important consequence when the requested URL returns a redirect.
Suppose WordPress generates:
http://example.com/wp-admin/admin-ajax.php?action=wordfence_doScan
But Cloudflare or the web server enforces HTTPS.
The HTTP request receives:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/wp-admin/admin-ajax.php?action=wordfence_doScan
An ordinary blocking HTTP client can follow that redirect.
A nonblocking request, however, may terminate before following it.
As a result, the intended scan-launch request never reaches the WordPress AJAX handler.
Wordfence attempts to start the scan, but the request responsible for initiating it doesn’t execute on the origin server.
This can produce repeated scan-start failures or unsuccessful attempts to resume scanning.
The specific behavior depends on the HTTP transport, Wordfence version, and server configuration.
Why Manual Scans May Still Work
One confusing symptom is that manually initiated scans may work while scheduled scans fail.
That doesn’t necessarily mean WordPress cron is broken.
Manual and scheduled scan initiation can involve different execution contexts, request sequences, and URL-generation behavior.
In particular, WordPress may detect HTTPS correctly during an administrative browser request while generating an HTTP URL during a background cron process.
Consequently, a successful manual scan doesn’t establish that the scheduled scan-launch request is being generated or delivered correctly.
The relevant question is:
What exact URL does Wordfence generate when a scheduled scan attempts to start?
Diagnose the WordPress URL Configuration
Start by inspecting the two WordPress URL options.
Using WP-CLI:
wp option get home
wp option get siteurl
For a website operating over HTTPS, the expected results are ordinarily:
https://example.com
https://example.com
If either value begins with http://, investigate the mismatch.
You can also inspect the actual URLs generated by WordPress:
wp eval '
echo "Home: " . home_url() . "\n";
echo "Site: " . site_url() . "\n";
echo "Admin AJAX: " . admin_url("admin-ajax.php") . "\n";
'
Pay particular attention to the Admin AJAX result.
If it shows:
http://example.com/wp-admin/admin-ajax.php
when the website requires HTTPS, Wordfence may be attempting to contact the wrong URL scheme.
This is especially relevant when the command runs in a CLI or cron context, where WordPress might not detect an HTTPS web request.
Confirm the Redirect Behavior
You can inspect the HTTP response with curl:
curl -sSI \
http://example.com/wp-admin/admin-ajax.php
If HTTPS redirection is enforced, the response may include:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/wp-admin/admin-ajax.php
That response establishes that an HTTP request encounters a redirect before reaching the HTTPS endpoint.
It doesn’t, by itself, prove that Wordfence’s scan request is failing.
For stronger evidence, compare the generated AJAX URL with your Nginx or Apache access logs during a scheduled scan attempt.
If the scan launcher is using HTTP and the origin server never receives the expected wordfence_doScan request, the redirect may be interrupting the nonblocking request.
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’t contain the initial HTTP request.
Fix the WordPress Home and Site URLs
If HTTPS is configured correctly for the website, update the WordPress options:
wp option update home 'https://example.com'
wp option update siteurl 'https://example.com'
Use the site’s actual hostname and preserve any legitimate subdirectory paths.
The two settings are distinct:
homedefines the address of the public website.siteurldefines the location of the WordPress application files.
They don’t necessarily have identical paths on every installation, so don’t blindly overwrite both with the same value.
The essential correction is to change the URL scheme from HTTP to HTTPS without altering the intended hostname or path.
Once corrected, check the generated AJAX URL again:
wp eval '
echo admin_url("admin-ajax.php") . "\n";
'
It should use HTTPS directly.
This removes the unnecessary redirect from the scan-launch request path.
Check for WP_HOME and WP_SITEURL Overrides
WordPress also supports defining its URLs directly in wp-config.php.
For example:
define('WP_HOME', 'http://example.com');
define('WP_SITEURL', 'http://example.com');
These constants override the corresponding values retrieved from the WordPress options table.
Therefore, changing the database options may not correct the effective URLs if these constants remain defined with HTTP.
Check wp-config.php for either constant.
For a correctly configured HTTPS installation, the definitions should use HTTPS:
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
If you use environment variables or another mechanism to populate these constants, correct the underlying configuration source.
What If the URLs Are Already HTTPS?
An HTTP-to-HTTPS mismatch is only one possible cause of failed scheduled scans.
If WordPress generates the correct HTTPS AJAX URL, investigate other potential causes:
- WordPress cron execution failures or missed scheduled events.
- Cloudflare WAF challenges affecting
admin-ajax.php. - Security rules blocking authenticated Wordfence scan-launch requests.
- PHP timeouts or resource exhaustion.
- Requests that fail to reach the origin server.
- Wordfence scan errors or invalid request signatures.
Don’t disable firewall protections or relax Wordfence authentication simply to make scheduled scans start.
First determine whether the scan-launch request is reaching WordPress, and if not, identify where it stops.
Why the Correct HTTPS Configuration Matters
This issue isn’t limited to Wordfence.
WordPress and its plugins regularly generate internal URLs for background tasks, asynchronous operations, REST API requests, and other integrations.
A browser can make a website look perfectly healthy because browsers generally follow HTTP-to-HTTPS redirects automatically.
Background HTTP clients don’t always behave the same way.
A working HTTPS redirect does not mean WordPress is correctly configured for HTTPS.
For websites that operate exclusively over HTTPS, both the effective WordPress URL settings and the URLs generated for internal requests should use HTTPS directly.
If Wordfence manual scans work but scheduled scans repeatedly fail, checking those generated URLs is a useful early diagnostic step.
The difference between http:// and https:// may be all it takes to prevent a nonblocking scan request from reaching WordPress.


