Working on a localhost version of my https live site. Using the WP Super Cache plug-in.

Trying to test it [Test Cache] with the feature with my live sites certificate I get the error

Fetching http://localhost/mysite/ to prime cache: FAILED Errors: : cURL error 60: SSL certificate problem: unable to get local issuer certificate

Trying it with a self-signed certificate OpenSSL and cacert.pem in a httpd-ssl.conf and php.ini modified localhost WAMP configuration I get the error:

Fetching http://localhost/mysite/ to prime cache: FAILED Errors: : cURL error 60: SSL certificate problem: self signed certificate

I even tried disabling SSL verification off in the WordPress init

add_action( 'init', 'sslfalse' );

function sslfalse() {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

And I still get the same error regardless.

Anyone know of a possible solution to getting WP Super Cache (or any caching plug-in) to work with HTTPS on localhost?

  • 1
    An unchecked quick gut feeling shot in dark ( so not done as answer). Keep your "sslfalse()" and also add $_SERVER['HTTPS']='on'; to your wp-config.php
    – scytale
    Jan 11, 2018 at 9:23
  • No luck, thanks anyways! I'm also using the ReallySimpleSSL plug-in to enable SSL on my site, so maybe this has something to do with it? I'll continue to mess around with it... might have to disable https all together on my local environment, but I'd prefer not to as to keep everything congruent.
    – bbruman
    Jan 11, 2018 at 22:31
  • Actually that did do something. If served over http it caches fine on test. HTTPS test fails though. It did not do that before without that in my wp-config.
    – bbruman
    Jan 11, 2018 at 23:36

1 Answer 1


Follow on to comment is too long so done as answer:

As I understand it your test site works as HTTPS unless WPSC is activated?

  1. Another (quick to test) hunch:

    Under WPSC "Advanced" settings: check on "Simple" then check the "Late Init" (and/or "HTTP Headers") boxes - save settings. N.B. if you deactivate WPSC these settings are lost and will require re-checking.

    You mentioned trying another caching plugin - if so try one that executes later without mod_rewrites. I wrote the Country Caching plugin extensions for both WPSC and Comet cache. So I'd suggest trying Comet Cache; it is not as sophisticated as WPSC, but as a plugin author, I found it to be better designed.

    N.B. If you are testing e.g. an ecommerce site where what is not cached is often more important than what is - then both live and test should use the same caching plugin and ideally with the same caching method settings.

  2. Add contents of yourInstalled.cert to WP's certification authority (CA) list

    No personal knowledge; but a post about a similar WPSC problem on nginx advises adding the text of your self signed cert to "/wp-includes/certificates/ca-bundle.crt". It will have to be re-applied after every WP update.

  3. Pay a web host for a test environment on a separate server.

    It might be possible to create a LetsEncrypt cert for use on a "localhost" but this would be far from straight forward.

    If you are running a commercial site then I would have thought it would be worth paying ($5? p.m.) to a web host with choice of PHP version, MySQL & cpanel with free LetsEncrypt SSL cert install. Buy a new domain, or CNAME a sub domain for use in this environment; obviously WP will have to be configured for this new domain - but your environment can be a (near) exact match to live. Prevent indexing via robots.txt, noindex, and maybe basic authentication. Disable site when not testing. When not in use switch to maintenance mode and disable/redirect away via conf/htaccess.

"might have to disable https on my local environment, but I'd prefer to keep everything congruent"

If site serves same content under both HTTP and HTTPS, then limiting test to HTTP again should not be a problem. If caching requirements are straight forward e.g. you do not have to worry about what is not being cached on an e-commerce site or you are not caching by visitor country; then disabling caching on test is another option.

  • HTTPS on everything works fine (aside from a not secure/invalid certificate notification in chrome) regardless of WPSC. I was/am using the ReallySimplySSL plug-in as well (this moves the entire site onto SSL/HTTPS). Brilliant reply and insight regardless, thank you! I'll be giving these a try later to follow-up. They seem like novel ideas I haven't thought to try yet. Additionally this is indeed an eCommerce site (which is especially the reason I wanted to test fully on localhost beforehand).
    – bbruman
    Jan 13, 2018 at 17:56
  • 1
    Still have to mess around with everything, but #2 did it! HTTPS pages are now being cached and no more error. Thank you for all the insight and help!
    – bbruman
    Jan 14, 2018 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.