WordPress.org

Ready to get started?Download WordPress

Forums

Autoptimize
[resolved] woocommerce & autoptimizer https issue (4 posts)

  1. dbs121
    Member
    Posted 1 year ago #

    hi,

    i am using autoptimizer with woocommerce (both latest versions). while testing i notice when i am logged in and then logout the site from the frontend will break (i'm using chrome) because of the following errors listed in the inspector window:

    [blocked] The page at https://www.mysite.com/my-account/ ran insecure content from http://www.mysite/wp-content/cache/autoptimize/autoptimize_85eee0c5db682bdc9b0cb2eaeefb618b.php.

    [blocked] The page at https://www.mysite/my-account/ ran insecure content from http://www.mysite/wp-content/cache/autoptimize/autoptimize_6766732f7f1f0f4e059fb624eeb8accd.php.

    looks like it's caught out by non-secure cached content.

    is there a workaround for this as autoptimizer is my go-to optimizer for wp.

    thanks!

    http://wordpress.org/extend/plugins/autoptimize/

  2. futtta
    Member
    Plugin Author

    Posted 1 year ago #

    OK, problem indeed is that Autoptimize forces the aggregated & minimized js & css-files to be served over HTTP (or rather, it uses the WP_CONTENT_URL from wordpress, which tends to be http://abc.xyz/wp-content/ instead fo https://abc.xyz/wp-content/)

    easy fix: go into your wordpress admin and change the URL in site address and/or wordpress address from HTTP into HTTPS (or is it HTTPS already?).

    better fix (and will include something like this in the next version which I'm working on): open wp-content/plugins/autoptimize/autoptimize.php and from line 17 change

    //Plugin constants
    define('AUTOPTIMIZE_CACHE_DIR',WP_CONTENT_DIR.'/cache/autoptimize/');
    define('AUTOPTIMIZE_CACHE_URL',WP_CONTENT_URL.'/cache/autoptimize/');
    define('AUTOPTIMIZE_CACHE_DELAY',true);

    into:

    //Plugin constants
    $WP_CONTENT_URL_SSLFIX=(empty($_SERVER['HTTPS'])) ? WP_CONTENT_URL : str_replace("http://", "https://", WP_CONTENT_URL);
    define('AUTOPTIMIZE_CACHE_DIR',WP_CONTENT_DIR.'/cache/autoptimize/');
    define('AUTOPTIMIZE_CACHE_URL',$WP_CONTENT_URL_SSLFIX.'/cache/autoptimize/');
    define('AUTOPTIMIZE_CACHE_DELAY',true);

    and let me know if that solves your aches.

  3. dbs121
    Member
    Posted 1 year ago #

    yes, that did it - thank you so much - i opted to edit the autoptimize.php file as you listed and works great now.

    thanks again!

  4. futtta
    Member
    Plugin Author

    Posted 1 year ago #

    you're welcome, thanks for the great rating! :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.