• Here’s my issue.
    My site was created a long time ago, and it has lots of pages. In pages, there are lots of links and images.
    Now, I decided to use Cloudflare Flexible SSL on my site. It works just fine (with either (one, two) of the plugins, but there is always an issue whenever I use any lazyload plugin to lazyload images – they load with HTTP in src attribute, because they seem to parse it at some point and carry it all the way till the page loads and script is used.
    To make sure HTTPS works everywhere, I enabled Cloudflare’s “Automatic HTTPS Rewrites” function, but it doesn’t help with the issue as it doesn’t seem to rewrite contents of data-lazy-src in .

    I tinhk the proper way to do it wolud be removing protocols from links to resources in content by myself (either by hand or via regex clean-up in the database), but I thought, as I settled on using your plugin of all the alternatives (they all share this flaw, as the way they work is identical I suppose), I might as well fix it with modyfing plugin source.
    So, here’s the fix to be put in easy-loader-php.php:

    ...
    foreach ( $matches[0] as $imgHTML ) {
    	// Support for Cloudflare (and the like) flexible SSL: remove protocols from src, data-src-lazy and noscript img
    	// Omit both HTTP and HTTPS from the beginnig of an image src link
    	$imgHTML = preg_replace( '/https*:/i', '', $imgHTML );
    	// Omit only HTTP
    	//$imgHTML = preg_replace( '/http:/i', '', $imgHTML );
    
    	preg_match( '/width=["|\']([^("|\')]+)["|\']/i', $imgHTML, $width_match );
    ...

    I would suggest adding a checkbox in plugin’s options to enable/disable this behaviour at will, as it is needed only in this case, as far as I can tell. The least amount of processing arrays, the better, I guess.

    • This topic was modified 6 years, 8 months ago by mackzwellz.
    • This topic was modified 6 years, 8 months ago by mackzwellz.
    • This topic was modified 6 years, 8 months ago by mackzwellz.
    • This topic was modified 6 years, 8 months ago by mackzwellz.
  • The topic ‘Lazyload images + Flexible SSL’ is closed to new replies.