Title: 4.4 https rewritte aint working with images
Last modified: August 30, 2016

---

# 4.4 https rewritte aint working with images

 *  Resolved [Daniel](https://wordpress.org/support/users/gabu69/)
 * (@gabu69)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/)
 * Since the new upgrade to 4.4 the images some will be broken in https cause of
   the srcset=
 * the srcset will be set to http:// rather than //
 * [https://wordpress.org/plugins/cloudflare/](https://wordpress.org/plugins/cloudflare/)

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/page/2/?output_format=md)

 *  [gwenvador](https://wordpress.org/support/users/gwenvador/)
 * (@gwenvador)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827397)
 * Having the same issue. Hopefully the plugin will be upgraded.
 *  [Shane Gowland](https://wordpress.org/support/users/thewebatom/)
 * (@thewebatom)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827446)
 * I had the same issue on a couple of sites, but only if the ‘siteurl’ and ‘homeurl’
   fields in wp_options did not begin with ‘[https://&#8217](https://&#8217);.
 *  [Brandon Hubbard](https://wordpress.org/support/users/bhubbard/)
 * (@bhubbard)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827581)
 * Seeing the same issue.
 *  [imforza-bhubbard](https://wordpress.org/support/users/imforza-bhubbard/)
 * (@imforza-bhubbard)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827655)
 * I started digging into this issue. Been adding improvements and fixes on my github.
   
   [https://github.com/bhubbard/cloudflare](https://github.com/bhubbard/cloudflare)
 * For the broken images issue, I am still looking into it. The issue is the code
   around this line:
    [https://github.com/bhubbard/cloudflare/blob/master/cloudflare.php#L600](https://github.com/bhubbard/cloudflare/blob/master/cloudflare.php#L600)
 * Simply updating that line to include `srcset` will fix the first images in the`
   srcset` but the rest remain with `http://`
 *  [Joe McGill](https://wordpress.org/support/users/joemcgill/)
 * (@joemcgill)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827657)
 * For now, anyone wanting a workaround can use the following code.
 *     ```
       function ssl_srcset( $sources ) {
         foreach ( $sources as &$source ) {
           $source['url'] = set_url_scheme( $source['url'], 'https' );
         }
   
         return $sources;
       }
       add_filter( 'wp_calculate_image_srcset', 'ssl_srcset' );
       ```
   
 *  [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827668)
 * a++ Joe McGill
 * edit: Actually I don’t think you need to specify https in the set_url_scheme().
   That would force everything to https. If you have your site setup to be dynamic
   simply remove the ‘https’ in the second argument.
 * so–
 *     ```
       //wordpress 4.4 srcset ssl fix
       function ssl_srcset( $sources ) {
       	foreach ( $sources as &$source ) {
       		$source['url'] = set_url_scheme( $source['url'] );
       	}
   
       	return $sources;
       }
       add_filter( 'wp_calculate_image_srcset', 'ssl_srcset' );
       ```
   
 *  [Brandon Hubbard](https://wordpress.org/support/users/bhubbard/)
 * (@bhubbard)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827670)
 * Thanks Joe and Matt,
 * I actually updated it a bit for an if statement for if protocol rewriting is 
   enabled.
 *     ```
       //wordpress 4.4 srcset ssl fix
       function cloudflare_ssl_srcset( $sources ) {
   
       	$cloudflare_protocol_rewrite = load_protocol_rewrite();
   
       	if ($cloudflare_protocol_rewrite == 1) {
   
       	foreach ( $sources as &$source ) {
       		$source['url'] = set_url_scheme( $source['url'] );
       	}
   
       	return $sources;
   
       	} else {
   
       		foreach ( $sources as &$source ) {
       			$sources;
       		}
   
       		return $sources;
   
       	}
       }
       add_filter( 'wp_calculate_image_srcset', 'cloudflare_ssl_srcset' );
       ```
   
 *  [ludoviccharlier](https://wordpress.org/support/users/ludoviccharlier/)
 * (@ludoviccharlier)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827704)
 * Thank you very much for these codes. We hope that the plugin will be updated 
   soon.
 *  [Brandon Hubbard](https://wordpress.org/support/users/bhubbard/)
 * (@bhubbard)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827708)
 * Can anyone from [@cloudflare](https://wordpress.org/support/users/cloudflare/)
   address this current issue? Who is responsible for updating the plugin? How long
   until we can expect an update?
 * I attempted to provide some improvements with a pull-request on github: [https://github.com/cloudflare/CloudFlare-Tools/pull/16](https://github.com/cloudflare/CloudFlare-Tools/pull/16)
 *  [Shane Gowland](https://wordpress.org/support/users/thewebatom/)
 * (@thewebatom)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827711)
 * It’s disappointing to see no one from CloudFlare even acknowledging these issues.
   Especially since you’ve already done most of their work for them.
 *  Thread Starter [Daniel](https://wordpress.org/support/users/gabu69/)
 * (@gabu69)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827713)
 * I´ve opened a support ticket and they replied they know about the bug and were
   working on it, but still its bad they dont reply here anything
 *  [josephvb10](https://wordpress.org/support/users/josephvb10/)
 * (@josephvb10)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827730)
 * So, can Brandon’s code be modified somehow to also fix the oEmbed issue.
 * It’s unnacceptable how Cloudflare are just ignoring the issues.
 *  [Brandon Hubbard](https://wordpress.org/support/users/bhubbard/)
 * (@bhubbard)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827736)
 * Latest response I received from CloudFlare:
 * “Thanks, our engineering team is aware of the fix and is integrating it with 
   our latest updates. This should come out within the next couple of weeks or shortly
   into the new year. Please let me know if you have any other questions.”
 *  [kwisatz](https://wordpress.org/support/users/kwisatz/)
 * (@kwisatz)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827754)
 * [edited] Sorry, should have read first, written later.
 *  [Brandon Hubbard](https://wordpress.org/support/users/bhubbard/)
 * (@bhubbard)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/#post-6827770)
 * Has anyone received an official confirmation of any updates being worked on or
   coming?

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/page/2/?output_format=md)

The topic ‘4.4 https rewritte aint working with images’ is closed to new replies.

 * ![](https://ps.w.org/cloudflare/assets/icon-256x256.png?rev=2471183)
 * [Cloudflare](https://wordpress.org/plugins/cloudflare/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cloudflare/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cloudflare/)
 * [Active Topics](https://wordpress.org/support/plugin/cloudflare/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cloudflare/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cloudflare/reviews/)

 * 18 replies
 * 13 participants
 * Last reply from: [thellimist](https://wordpress.org/support/users/furkan811/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/44-https-rewritte-aint-working-with-images/page/2/#post-8612527)
 * Status: resolved