Support » Plugin: Autoptimize » It generate http:// instead of https:// for optimized file

  • Resolved yylzcom

    (@yylzcom)


    Everything worked fine until I turned on http protocol on 80 port, just for Let’s Encrypt verification.

    I found that JS and CSS was not load because they are use http protocol instead of https.

    I now turn off http to see if this error happen again or not.

    Can you please check or just use relative protocol?

    Thanks very much for this plugin.

    https://wordpress.org/plugins/autoptimize/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frank Goossens

    (@futtta)

    hi yylzcom;
    as per this line in autoptimize.php, the protocol used is actually the one returned by wp core’s content_url() which is based on the WP_CONTENT_URL constant and which as per the codex;

    retrieves the url to the content area for the current site with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise.

    Obviously the limitations of is_ssl (cfr. codex) apply here as well.

    As a workaround you could either set WP_CONTENT_URL in wp-config.php or you could set your https-URL as the CDN base URL in Autoptimize.

    Hope this clarifies,
    frank

    I did as you suggest, but did not work. The true reason is the wp-super-cache plugin. Once load page from HTTP protocol for the first time, it will build the cache with HTTP url, even if I setup CDN base to https address in wp-super-cache.

    Plugin author said “There is no fix for this outside of creating rewrite rules in your .htaccess file to control if a page is forced to/from HTTPS

    I have to do this after I successfully sign the cert from Let’s Encrypt. As long as the cert is valid, the renewal can be done via HTTPS.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘It generate http:// instead of https:// for optimized file’ is closed to new replies.