# WP Cron not working on secured sites

**URL:** <https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147>\
**Category:** Support\
**Created:** [December 5, 2016, 10:53am UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147 "2016-12-05T10:53:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xaver](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/xaver/32/9623_2.png) [@Xaver](https://community.localwp.com/u/Xaver)\
**Post date:** [December 5, 2016, 10:53am UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/1 "2016-12-05T10:53:06Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [December 5, 2016, 3:19pm UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/2 "2016-12-05T15:19:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Xaver](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/xaver/32/9623_2.png) [@Xaver](https://community.localwp.com/u/Xaver)\
**Post date:** [December 5, 2016, 8:45pm UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/3 "2016-12-05T20:45:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![donjayeworld](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@donjayeworld](https://community.localwp.com/u/donjayeworld)\
**Post date:** [March 11, 2017, 12:36am UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/4 "2017-03-11T00:36:27Z")

</div>

where did you add the snippet?

---

<div class="post-metadata">

**Author:** ![Xaver](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/xaver/32/9623_2.png) [@Xaver](https://community.localwp.com/u/Xaver)\
**Post date:** [March 21, 2017, 7:51pm UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/5 "2017-03-21T19:51:48Z")

</div>

Just add it in your [themes functions.php](https://codex.wordpress.org/Functions_File_Explained) file or create a dedicate plugin

---

<div class="post-metadata">

**Author:** ![ripencreative](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@ripencreative](https://community.localwp.com/u/ripencreative)\
**Post date:** [December 19, 2017, 1:55am UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/6 "2017-12-19T01:55:25Z")

</div>

works perfectly thanks for the snippet!

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [August 25, 2020, 6:31pm UTC](https://community.localwp.com/t/wp-cron-not-working-on-secured-sites/147/7 "2020-08-25T18:31:15Z")

</div>


