HTTP iframe in HTTPS website

Your site is reachable via HTTPS but you need to embed an iframe that has an HTTP source, how can you do it without generating mixed content errors?

Thanks to this code you will be able to fetch the iframe data on server side.

if ( isset( $_GET['proxy'] ) && isset( $_GET['url'] ) && md5( esc_attr( $_GET['url'] ) ) === $_GET['proxy'] ){
   $response = wp_remote_get( esc_url( $_GET['url'] ) );
   if( $response ){
       echo wp_remote_retrieve_body( $response );

Here the code to create a shortcode where you can write the iframe URL.

add_shortcode( 'eos_http_iframe','eos_http_iframe' );
function eos_http_iframe( $atts ){
	$atts = shortcode_atts( array(
		'url' => '',
		'class' => '',
		'width' => '100%'
	),$atts,'eos_http_iframe' );
	if( '' === $atts['url'] ) return;
	$class = '' !== $atts['class'] ? ' '.$class : '';
	return '<iframe style="width:'.esc_attr( $atts['width'] ).'" class="eos-http-iframe'.esc_attr( $class ).'" src="?proxy='.md5( esc_attr( $atts['url'] ) ).'&url='.esc_url( $atts['url'] ).'"></iframe>';

If you prefer it you can directly download the mini plugin that includes this code.

Both if you have added the code above or installed the plugin, to load an HTTP iframe on your HTTPS website you have just to use the shortcode

Where is the source of the HTTP iframe.