vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Mini Mods - IMG Cacher - SSL Keeper - Mixed Content Block Solution (https://vborg.vbsupport.ru/showthread.php?t=288060)

hugoroger 01-28-2017 09:50 PM

I installed this but I am trying to get pages like:

https://www.iforumelite.com/content....e-contratacoes
https://www.iforumelite.com/content.php

Secure but this did not work.

I did everything except add this:

User-agent: *
Disallow: /cache.php
Also I suggest you add something like this to .htaccess:
Code:

<FilesMatch "cache\.php$">
Header set Cache-Control "max-age=86400, public"
</FilesMatch>

Alan_SP 01-29-2017 05:33 AM

These images are served from your system as attachments. I don't use attachments, but I'm sure there's a way to sort this out. Look at attachment options, or also you can rebuild styles, but this mod shouldn't touch images on your domain, that is why you have problem in my opinion.

Alan_SP 01-29-2017 05:49 AM

Quote:

Originally Posted by DSemen (Post 2580978)
Please tell me how to install it correctly.

You have file cache.php, you need to upload it to your forum root directory.

Well, you replace original content of that file with this code. Whole content, not just part of it. Basically, you quoted how new cache.php looks like.

Also, everything else needs to stay same, i.e. you need to create plugin which calls cache.php.

It works for me, except for some images (few here and there, maybe slower sites that react slowly).

Alan_SP 01-29-2017 06:06 AM

This mod do images from https hosts and for some reason have problem with images taken from Facebook.

Is there a solution for this, either that all images work, or that mod just starts ignoring images from https hosts.

I guess that plugin code should be different, to check not only if images is from different host, but that image comes only from http hosts. This also would speed this mod greatly. Is there someone who knows how to check if image is from host already with https?

djbaxter 02-15-2017 09:14 AM

Quote:

Originally Posted by MegaManSec (Post 2367828)
I'll give you an example of how to do it.

This is mine:
[code]

edit this part:

Code:

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
and make it https:// :p

Even easier:

Change

Code:

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
To:

Code:

src="//pagead2.googlesyndication.com/pagead/show_ads.js">

bridge2heyday 02-19-2017 09:21 PM

This is my version of this plugin
PHP Code:

$link_parsed parse_url($link);
if( 
$link_parsed['scheme'] == 'http'){
    
$ssl 'https://'.$link_parsed['host'];
    
$stream = @stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
    
$read = @fopen($ssl"rb"false$stream);
    
$cont = @stream_context_get_params($read);
    
$var = ($cont["options"]["ssl"]["peer_certificate"]);
    
$result = (!is_null($var)) ? true false;
    if(
$result) {
    
$link str_replace('http','https',$link);
    
$retval = ($fullsize '<div class="size_fullsize">' '')  . '<img src="' .  $link '" border="0" alt="" />' . ($fullsize '</div>' '');
    } else {
        
$link $this->registry->options['bburl'] . '/cache.php?img=' urlencode($link);
        
$retval = ($fullsize '<div class="size_fullsize">' '')  . '<img src="' .  $link '" border="0" alt="" />' . ($fullsize '</div>' '');
    }
    


it checks if image https => OK
if image http .. check for https version .. if the https version is OK => OK
if the https version not working .. use the script

Alan_SP 02-23-2017 04:16 PM

Great work bridge2heyday, do you maybe have better code for cache.php? I noticed that it slows down loading of pages and also that some images don't work with it, but work when I disable plugin (i.e. disable cache.php).

It would be great if there's faster and 100% compatible version of this mod. That all images on http that work (some don't work) can be transferred to https.

bridge2heyday 02-23-2017 07:37 PM

Quote:

Originally Posted by Alan_SP (Post 2582790)
Great work bridge2heyday, do you maybe have better code for cache.php? I noticed that it slows down loading of pages and also that some images don't work with it, but work when I disable plugin (i.e. disable cache.php).

It would be great if there's faster and 100% compatible version of this mod. That all images on http that work (some don't work) can be transferred to https.

Thank you , I didn't look at cache.php file .. I just did this small modification for a client .. though , my code may be improved by checking if the file is previously cached or not before looking for validity of https image .. because connection overhead may slow down the site .
There may be alternative solution - I did for an other client - to add white-list for known image hosting websites which turned using SSL .. if the image is hosted on one of those sites .. the link will be changed to https .. if not , it will be displayed as plain text image URL

Alan_SP 02-25-2017 05:12 PM

I checked, cache.php doesn't actually cache images in cache directory, it probably just create image there temporarily and delete it after it is sent to browser. At least I didn't found images in cache folder.

Anyway, it would be great if cache.php can work with all images, as some images don't work, not sure why. With your plugin modification and cache.php that work with all images (and hopefully faster), this would be great for making site completely https compatible.

Beor 02-26-2017 09:06 PM

Hello

This modification works for vb5?

Signatures of our forum not is on https

BR

djbaxter 04-11-2017 08:24 PM

Thank you. I was having difficulty with the "mixed content" warning for one of my forums which exists as a subdomain.

I tried a competitive add-on which sadly did not work for me.

Your instructions for installing this add-on are a little ambiguous
  • files and folders to upload (cache-img and images folders, cache.html, cache.php) might be better packaged under the standard Upload folder
  • you need to add the instruction to change the properties of the cache-img folder to 777 after uploading
  • the instructions on replacing [LINK_TO_YOUR_WEBSITE] with the domain of the forum might explicitly state "including the square brackets"

but I am very happy to report that this completely resolved the mixed content issue for me. :up:

weinstoc 09-07-2017 03:38 PM

Hi,

I installed this and it looked like it was working fine...but I forgot that our forums are served out of three load balanced servers...so each had its own cache. I moved the location of cache-img to a shared device to solve this. What can I do to make the previously cached images show up properly? (There already so many cached files on each server that the mv * command gets an error.)

Dave 09-07-2017 03:57 PM

What do you mean by "What can I do to make the previously cached images show up properly?"?
Did you move all the images to the cache folder on the new server but it's not working? Are you sure the chown (group) and chmod permissions are properly setup?

weinstoc 09-07-2017 04:03 PM

I am in the process of moving them now. When I could not get a simple mv * /shared_folder to work I was hoping things would be re-cached. But I am using tar to do the transfer now. Hopefully that will work.

weinstoc 09-07-2017 04:21 PM

Ok, everything has been moved...but this isn't showing up. It seems to be an aberration though as others are showing up fine.

https://forumserver.twoplustwo.com/s...&postcount=392

Dave 09-07-2017 04:42 PM

Does the file https%3A%2F%2Fimgur.com%2FMkp4JII.gif exist in the cache folder?
If it does exist, it might be a permission problem of the file or cache folder.

Guinevere 09-13-2017 12:36 AM

Great mod and fixes the mixed content issue, thanks - unfortunately we run a pretty large forum and the saved images are adding about 300mb a day to our server... anyone know of an option that doesn't require the use of so much server space? That's going to be an extra GB every four days, so it's fine for a temporary solution but not in the long term.

edit: If anyone else has this issue, and wants an alternate solution I ended up adding a replacement variable in each skin which found instances of http: and changed them to https: , after giving the members warning that they would only be able to use image hosts that supported https from now on.

woodmj 09-17-2017 10:45 AM

Brilliant mod! Goodbye mixed content issues.

Rob Graves 10-16-2017 08:57 PM

Thanks man! You ever come to Negril, look me up! The first rounds are on me!

BGObsession 10-23-2017 04:37 PM

I've installed this but it has not resolved my mixed content flags at https://www.bgobsession.com

Yes - I've done the following:
1) All files uploaded to root directory
2) CHmodded the cache-img folder to 777
3) Created plug-in and added my website address to the [] field
4) Edited my robots.txt file and the .htaccess file as described

I've done a cache clear on vbulletin admincp, cleared my Sucuri firewall cache, and browser cache but still getting mixed content flagged.

Any ideas or suggestions would be greatly appreciated.

djbaxter 10-23-2017 04:52 PM

Start by trying to determine what is causing the mixed content flags: It may be scripts or advertising (including AdSense) as well as images. Test your site here:

Why No Padlock? - Why is my SSL web page insecure? Find the culprit!

SSL-check: crawl your HTTPS website and find unsecure content

Website Scanner

Address any errors you see there. Sometimes, just replacing http:// with simply // will do the trick in scripts and plugins.

Also, even if it's only images, you won't see an immediate result. You'll need to allow some time to scan all your images - and that may take a while if you have a lot of them.

Are you seeing any entries in the cache-img folder?

BGObsession 10-23-2017 04:56 PM

I'll take a look at those resources.

No - I'm not seeing anything in the cache-img folder except for the .htaccess file so far...

Dave 10-23-2017 04:56 PM

That's because you still have a lot of resources that are served over HTTP, things that this plugin doesn't take care of.

Example:
Mixed Content: The page at 'https://www.bgobsession.com/content.php/1079-Blognostications-Week-7-Redskins-at-Eagles-Edition' was loaded over HTTPS, but requested an insecure image 'http://bgobsession.com/images/smilies/smile.png'. This content should also be served over HTTPS.

Mixed Content: The page at 'https://www.bgobsession.com/forum.php?home=1' was loaded over HTTPS, but requested an insecure image 'http://bgobsession.com/images/icons/icon1.png'.

In the AdminCP under Styles & Templates, create a replacement rule of:
http://www.bgobsession.com to https://www.bgobsession.com

BGObsession 10-23-2017 05:01 PM

1 Attachment(s)
So - ran my site's homepage on the first tool. Here's what I get... So why would I still be getting the mixed content warning?

BGObsession 10-23-2017 05:14 PM

The replacement variable addition fixed a lot of it - thanks so much dj (should've thought of that myself!).

Have a few image links that are still showing up insecure on my forums page.

Total number of items: 133
Number of insecure items: 2
Insecure URL: http://bgobsession.com/images/icons/icon1.png
Found in: https://www.bgobsession.com/forum.php?home=1

Insecure URL: http://bgobsession.com/images/icons/icon4.png
Found in: https://www.bgobsession.com/forum.php?home=1

Not to be dense, but where do I change the image urls for forum page icons?

Dave 10-23-2017 05:16 PM

Try making another replacement rule of:
http://bgobsession.com to https://www.bgobsession.com

BGObsession 10-23-2017 05:26 PM

That did it - thanks so much!

Dave-ahfb 01-22-2018 12:42 PM

I am having issues with the fulls size image going 404 while the thumbnail works fine.

An example may be viewed at https://www.websleuths.com/forums/sh...mage-not-found

-or-

https://www.websleuths.com/forums/at...0&d=1516479468

Of course the thumbnail calls the image as an attachment, the 404'd full size image is called from
Code:

https://www.websleuths.com/forums/cache.php?img=https%3A%2F%2Fwww.websleuths.com%2Fforums%2Fattachment.php%3Fattachmentid%3D129050%26amp%3Bstc%3D1
My plugin is active using hook bbcode_img_match and is 5th in execution, the plugin code is
Code:

$link_parsed = parse_url($link);
if ($link_parsed['host'] != '[www.websleuths.com]')
{
 $link = $this->registry->options['bburl'] . '/cache.php?img=' . urlencode($link);
 $retval = ($fullsize ? '<div class="size_fullsize">' : '')  . '<img src="' .  $link . '" border="0" alt="" />' . ($fullsize ? '</div>' : '');
}


Any ideas?

Dave 01-22-2018 02:00 PM

[www.websleuths.com] should be changed to www.websleuths.com in the hook PHP code.

Dave-ahfb 01-22-2018 02:08 PM

Thank you.

final kaoss 03-01-2018 05:02 AM

Thanks, I've added it to my new article which helps to prevent mixed content issues.
https://vborg.vbsupport.ru/showthread.php?t=326118

therother 05-14-2018 08:54 PM

I've been using bridge2heyday's plugin with this mod. It seems to work great for most things. But I've been noticing a significant slow down on older threads where the images are now longer available, on either http or https. So particularly image heavy threads can take upwards of ten minutes to load.

I've been identifying image sites that can be autoupdated from http to https (eg imgur and imageshack), which has alleviated some of the issue, but is there a more robust solution?

rekha 07-03-2018 07:28 AM

nice mod

NeoDio 10-10-2018 05:48 AM

Quote:

Originally Posted by hakkuo23 (Post 2397833)
Here is a version that just displays the image, and doesn't save it, to save server space :)

PHP Code:

<?php

function curlHeaderCallback($query$header){
    global 
$mime;
    if(
stripos($header"content-type")!==false){
        
header(trim($header));
    }
    return 
strlen($header); 
}

$image $_GET['img'];

$query curl_init($image);
curl_setopt($queryCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9");
curl_setopt($queryCURLOPT_CONNECTTIMEOUT ,0);
curl_setopt($queryCURLOPT_TIMEOUT10);
curl_setopt($queryCURLOPT_HEADERFUNCTION'curlHeaderCallback'); 
curl_setopt($queryCURLOPT_RETURNTRANSFER1);
$ret curl_exec($query);
echo 
$ret;


I'm confused as to where this goes. It looks like it's supposed to replace the code inside the function getimg($url) but wouldn't that make it stop working since it's not using the curl_init($url) anymore? Also is that HeaderCallback function supposed to go inside the getimg function as well?

richTV 08-08-2019 02:52 AM

anyone try this on vB3 ?

I'm using vb3.8.7 Patch Level 2

z3r0 08-08-2019 03:59 AM

Quote:

Originally Posted by richTV (Post 2600162)
anyone try this on vB3 ?

I'm using vb3.8.7 Patch Level 2

https://vborg.vbsupport.ru/showthrea...75#post2411575


All times are GMT. The time now is 06:47 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01387 seconds
  • Memory Usage 1,848KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (36)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete