MyBB Community Forums

Full Version: Mybb 1.8 image proxy for HTTPS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2016-07-10, 08:11 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 11:00 AM)Euan T Wrote: [ -> ]As far as I know, there isn't an existing system to do this. I've been meaning to write one, just haven't got around to it yet. If I get time over the next week or two, I'll have a look.

by system, what do you mean?

A simple plugin to hook into Camo, using the post parser rather than pre_output_page, with settings for the camp URL etc.
(2016-07-10, 09:11 PM)Euan T Wrote: [ -> ]
(2016-07-10, 08:11 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 11:00 AM)Euan T Wrote: [ -> ]As far as I know, there isn't an existing system to do this. I've been meaning to write one, just haven't got around to it yet. If I get time over the next week or two, I'll have a look.

by system, what do you mean?

A simple plugin to hook into Camo, using the post parser rather than pre_output_page, with settings for the camp URL etc.

nice. anxiously awaiting this!
(2016-07-10, 10:09 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 09:11 PM)Euan T Wrote: [ -> ]
(2016-07-10, 08:11 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 11:00 AM)Euan T Wrote: [ -> ]As far as I know, there isn't an existing system to do this. I've been meaning to write one, just haven't got around to it yet. If I get time over the next week or two, I'll have a look.

by system, what do you mean?

A simple plugin to hook into Camo, using the post parser rather than pre_output_page, with settings for the camp URL etc.

nice.  anxiously awaiting this!

I've been told that I might get beaten to it by another team member with an existing plugin, so we might have a race on Wink
(2016-07-11, 10:30 AM)Euan T Wrote: [ -> ]
(2016-07-10, 10:09 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 09:11 PM)Euan T Wrote: [ -> ]
(2016-07-10, 08:11 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 11:00 AM)Euan T Wrote: [ -> ]As far as I know, there isn't an existing system to do this. I've been meaning to write one, just haven't got around to it yet. If I get time over the next week or two, I'll have a look.

by system, what do you mean?

A simple plugin to hook into Camo, using the post parser rather than pre_output_page, with settings for the camp URL etc.

nice.  anxiously awaiting this!

I've been told that I might get beaten to it by another team member with an existing plugin, so we might have a race on Wink

L-l-lets get ready to RUMMMMBBBBLLLLEEEEEEEE!

Thanks to everyone for their help.
With the help of the Mybb Staff team (who are awesome, I might add) this has now been solved and SSL is working great. https://forumauthority.com/

Thanks to everyone for their support!
(2016-07-11, 10:30 AM)Euan T Wrote: [ -> ]
(2016-07-10, 10:09 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 09:11 PM)Euan T Wrote: [ -> ]
(2016-07-10, 08:11 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 11:00 AM)Euan T Wrote: [ -> ]As far as I know, there isn't an existing system to do this. I've been meaning to write one, just haven't got around to it yet. If I get time over the next week or two, I'll have a look.

by system, what do you mean?

A simple plugin to hook into Camo, using the post parser rather than pre_output_page, with settings for the camp URL etc.

nice.  anxiously awaiting this!

I've been told that I might get beaten to it by another team member with an existing plugin, so we might have a race on Wink

I tested the plugin you referenced and it works quite well so far! Toungue

(2016-07-11, 10:35 AM)katos Wrote: [ -> ]
(2016-07-11, 10:30 AM)Euan T Wrote: [ -> ]
(2016-07-10, 10:09 PM)andrewjs18 Wrote: [ -> ]
(2016-07-10, 09:11 PM)Euan T Wrote: [ -> ]
(2016-07-10, 08:11 PM)andrewjs18 Wrote: [ -> ]by system, what do you mean?

A simple plugin to hook into Camo, using the post parser rather than pre_output_page, with settings for the camp URL etc.

nice.  anxiously awaiting this!

I've been told that I might get beaten to it by another team member with an existing plugin, so we might have a race on Wink

L-l-lets get ready to RUMMMMBBBBLLLLEEEEEEEE!

Thanks to everyone for their help.
With the help of the Mybb Staff team (who are awesome, I might add) this has now been solved and SSL is working great. https://forumauthority.com/

Thanks to every

one for their support!

I'm still seeing mixed content warnings on some of your pages..for example: https://forumauthority.com/Thread-TechRa...Book--1778

as an aside - nice, clean theme. kudos!
Some pages are still being worked on due to poor coding. The site is custom made from scratch and some image resources are referred to with http:// -- I am working to sort this! :-)

Thanks for your kind words on our theme. Glad you like it, the team have worked very hard on it!
I actually wrote something for this a while ago. It uses googles image server to proxy the image.

<?php
if(!defined('IN_MYBB'))
{
	die('This file cannot be accessed directly.');
}

$plugins->add_hook('pre_output_page', 'image_proxy');

function gip_info() {
	return array(
		'name'			=> 'Google Image Proxy',
		'description'	=> 'Proxy Non-HTTPS images through Googles HTTPS server',
		'author'		=> 'Boonie',
		'version'		=> '1.0',
		'compatibility'	=> '18*',
	);
}

function image_proxy($page) {
	// Find Non-HTTPS Images
	$find = '/\<img src="(http:\/\/(.+?))"/si';
	$page = preg_replace_callback($find, function ($matches) {
		global $mybb;

		// Get Non-HTTPS Images
		$matches = $matches[1];

		// Proxy the Image, remove "&refresh=31536000" for non-cached version
		$proxyimage = "https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url={$matches}&container=focus&refresh=31536000";

		// Output
		return "<img src=\"{$proxyimage}\"";
	}, $page);
	return $page;
}
(2016-07-12, 01:55 PM)Boonie Wrote: [ -> ]I actually wrote something for this a while ago. It uses googles image server to proxy the image.

<?php
if(!defined('IN_MYBB'))
{
	die('This file cannot be accessed directly.');
}

$plugins->add_hook('pre_output_page', 'image_proxy');

function gip_info() {
	return array(
		'name'			=> 'Google Image Proxy',
		'description'	=> 'Proxy Non-HTTPS images through Googles HTTPS server',
		'author'		=> 'Boonie',
		'version'		=> '1.0',
		'compatibility'	=> '18*',
	);
}

function image_proxy($page) {
	// Find Non-HTTPS Images
	$find = '/\<img src="(http:\/\/(.+?))"/si';
	$page = preg_replace_callback($find, function ($matches) {
		global $mybb;

		// Get Non-HTTPS Images
		$matches = $matches[1];

		// Proxy the Image, remove "&refresh=31536000" for non-cached version
		$proxyimage = "https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url={$matches}&container=focus&refresh=31536000";

		// Output
		return "<img src=\"{$proxyimage}\"";
	}, $page);
	return $page;
}
I had used such system on a friends forum, very similar plugin (made by a friend). The only problem is you will start receiving token authentication error on some occasions.Sometimes, you might get google recaptcha box in place of image. Google is very strict if we start abusing their system.

One more drawback to add is: if the source image is small size(px) [i forgot what size exactly] then it wont load the image even if you trim out the resize parameter, you will see blank box inplace of image.

Again you might get mixed content warning if the source image supports https but the user posts http version of image [This is when the source image host is behind cloudflare or some web-firewall, most of time on nginx server]

Few more drawback's to add but i seriously don't remember them now.

One last note:
The forum on which this was tested was big-board, with 1K active members at single time.Never faced issues with new forum with less online crowd

I ended up using an better plugin for this: http://community.mybb.com/thread-162572-...pid1116582
(2016-07-12, 02:29 PM)Donald_Duck Wrote: [ -> ]I had used such system, very similar plugin (made by a friend). The only problem is you will start receiving token authentication error on some occasions.Sometimes, you might get google recaptcha box in place of image. Google is very strict if we start abusing their system. I ended up using an better plugin for this: http://community.mybb.com/thread-162572-...pid1116582

I have not run into an issue yet, but that is good to know.
(2016-07-12, 02:41 PM)Boonie Wrote: [ -> ]
(2016-07-12, 02:29 PM)Donald_Duck Wrote: [ -> ]I had used such system, very similar plugin (made by a friend). The only problem is you will start receiving token authentication error on some occasions.Sometimes, you might get google recaptcha box in place of image. Google is very strict if we start abusing their system. I ended up using an better plugin for this: http://community.mybb.com/thread-162572-...pid1116582

I have not run into an issue yet, but that is good to know.

No problem dear  Blush
Pages: 1 2 3