WP Cron not working on secured sites

Hi there!

I’m running into an issue were the wp-cron is not working on a local site running over https.

The error I get is

cURL error 7: Failed to connect to mylocal.dev port 443: Connection refused

When I switch back to http everything is working smoothly. There’s also no difference running nginx over Apache.

Any help is appreciated!

Right now there are no certificates for container to container communications. Only the main router has the SSL certificates. This may change in the future.

For now you can just make those cross-container requests simply HTTP and then when you deploy you can switch to HTTPS.

Hi Clay!

Thanks for the info! I added a snippet to bypass this:

add_filter( 'cron_request', function( $args ) {

   $args['url'] = set_url_scheme( $args['url'], 'http' );
   return $args;

} );

It basically changes the https to http in the cron URL.

4 Likes

where did you add the snippet?

Just add it in your themes functions.php file or create a dedicate plugin

1 Like

works perfectly thanks for the snippet!