Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Jeff B on December 05, 2019, 01:26:37 PM

Title: ssl for images
Post by: Jeff B on December 05, 2019, 01:26:37 PM
Wasn't quite sure what to name this topic.  Here is my situation. I am about to install a secure server certificate. I think I have a handle on what I need to do in regards to the forum itself, but I have another issue.  Our forum has been around going on 20 yrs. From the beginning we required images to be in a bridged coppermine gallery to share in posts. We do not allow offsite images (THANK GOD THINK PHOTOBUCKET)  So, all images posted on our site are on our domain.  The file paths are all within our domain. How can I handle this once I enable the SSL so that all these http addresses don't show up as unsecure content to the browser?  .htaccess? Some other way.  We are talking well over a quarter million photos.
Title: Re: ssl for images
Post by: vbgamer45 on December 05, 2019, 01:33:38 PM
You can do a mysql find and replace on the messages table in the body column to change the link url from http://imagepath to https://imagepath
Always backup your database first


update smf_messages set body = REPLACE(body, "http://imagepath", "https://imagepath");
Title: Re: ssl for images
Post by: Illori on December 05, 2019, 01:37:48 PM
cant you just enable the image proxy and let it handle it? then you don't need to modify anything.
Title: Re: ssl for images
Post by: Arantor on December 05, 2019, 01:38:33 PM
Quote from: Illori on December 05, 2019, 01:37:48 PM
cant you just enable the image proxy and let it handle it? then you don't need to modify anything.

For the size and scale, fixing it is likely better.
Title: Re: ssl for images
Post by: vbgamer45 on December 05, 2019, 02:16:04 PM
Also more efficient in the long run instead of storing duplicate images and causing proxy.php to be called for the image requests
Title: Re: ssl for images
Post by: Jeff B on December 05, 2019, 02:21:36 PM
Yes, the proxy images the way I understand it seems like the forum would be taxed pretty hard, since there are probably photos is almost every topic page.

Is phpmyadmin sufficient to make a call like that for a forum with going on 2 million posts?  Or is there a better way?

Title: Re: ssl for images
Post by: vbgamer45 on December 05, 2019, 02:30:24 PM
Should be since the query should just execute. I would put site on maintenance mode just to prevent slowdowns when you run it.

If not command line mysql
Title: Re: ssl for images
Post by: lurkalot on December 05, 2019, 02:44:29 PM
Assuming the SSL cert also covers the domain where the gallery resides. 

In Coppermine, click "Config", and under general settings, change the URL of your Coppermine gallery folder to from http to https
Title: Re: ssl for images
Post by: Jeff B on December 05, 2019, 09:52:36 PM
Thank you! If okay, I'd like to keep this topic open until I get this completed? It might not happen until after the holidays.
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 09:53:36 AM
I've started this project. I have not addressed the gallery photos as of yet as I am trying to sort out all the other non-secure content first.  I am getting this in the firefox console and I cannot find the source of the conflict. any ideas on where to look? It is the last two instances I have on the board index page, on which I started.

Loading mixed (insecure) display content "https://mywebsite/board/uploaded_avatars/avatar_10176_1396655806.jpeg" on a secure pagescript.js:491:2
Loading mixed (insecure) display content "https://mywebsite/board/uploaded_avatars/avatar_10176_1396655806.jpeg" on a secure pagescript.js:491:2
Title: Re: ssl for images
Post by: Kindred on December 12, 2019, 09:56:25 AM
that would be some user's avatar....
Title: Re: ssl for images
Post by: Illori on December 12, 2019, 09:58:11 AM
if the image proxy is enabled, it should handle that for you.

basically it is all the same issue, you either manually convert the URLs and enable the image proxy or you just enable the image proxy.
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 10:35:48 AM
I enabled the image proxy with no love.  This actually shows up on all pages, not just the index. Maybe something in an old template edit somewhere?
Title: Re: ssl for images
Post by: Illori on December 12, 2019, 11:10:08 AM
link to where it is happening?
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 11:12:31 AM
pm sent
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 11:14:57 AM
Another note,  I just went and checked, it only occurs when logged in. If you are not logged in, the page is clear.
Title: Re: ssl for images
Post by: Illori on December 12, 2019, 11:21:53 AM
then we need the link provided in this topic so anyone that has time can assist you, along with a test log in so we can actually see the issue.
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 11:32:50 AM
More testing.  I logged into the test account and it doesn't do it. However, I changed the test account to an admin account, and then it occurs, but the error points to a different avatar. There should be NO avatars displayed on the page.  https://www.forestryforum.com/board/index.php

I would need to provide an admin account.
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 12:00:21 PM
I can provide an admin account but I got a warning about sending a pm unless asked to specifically to do so.
Title: Re: ssl for images
Post by: Jeff B on December 12, 2019, 03:11:14 PM
Okay, it does not have to be an admin account. I went back to the test account and added an avatar to the account. It then started throwing the content error for that login.  I deleted the avatar, but the error now remains.  Who can I send the test account login to?
Title: Re: ssl for images
Post by: shawnb61 on December 12, 2019, 03:21:05 PM
Quote from: vbgamer45 on December 05, 2019, 01:33:38 PM
You can do a mysql find and replace on the messages table in the body column to change the link url from http://imagepath to https://imagepath
Always backup your database first


update smf_messages set body = REPLACE(body, "http://imagepath", "https://imagepath");


The problem with this approach is that, I find, many sites are still not http.  If you do a change like this, the images will disappear.  The image proxy is the only way to deal with these http sites at the moment (assuming your goal is the padlock...). 

What would be very handy would be a utility to test for a redirect, and only if found, make that edit.
Title: Re: ssl for images
Post by: Illori on December 12, 2019, 03:22:54 PM
the OP said that the images are stored on their domain, so it should not be an issue.
Title: Re: ssl for images
Post by: shawnb61 on December 12, 2019, 03:24:42 PM
Ah, missed that...
Title: Re: ssl for images
Post by: Kindred on December 12, 2019, 08:43:06 PM
Is your avatar url set to https?
Title: Re: ssl for images
Post by: Jeff B on December 13, 2019, 02:02:38 AM
Yes. What I can't figure out is why there would be any reason for any avatar to be loading.
Title: Re: ssl for images
Post by: Jeff B on December 13, 2019, 08:03:14 AM
Lurkalot is a member of my forum and stopped by for a look and found it for me. It was an http call to a script for the mod autolink words. I disabled the mod and the issue went away.
Now onward to converting my gallery image calls, however I need to wait until after the holidays because we have a contest running and I can't take another chance of disrupting that.
Thank you for the help here and especially to Sir Lurkalot!
Title: Re: ssl for images
Post by: Kindred on December 13, 2019, 10:01:08 AM
ah...   yeah, that is frequently the case with mods that call external scripts.

I didn't have a chance to go to your actual site to look, but here's a little pointer:

ON a page that triggers the warning, do "view source of page"
search in the source code, do a search for "http:"
that should tell you what the actual call is and allow you to (possibly) figure out, from looking at the call or the display code around it, what area is causing the problem.

Then you get to have the fun of tracking down the section of code that the mod modified...  sometimes that is simple, sometimes not.
most mods that add javascript drop it into index.template.php or add it in their own file, via hooks
Title: Re: ssl for images
Post by: lurkalot on December 13, 2019, 12:30:39 PM
Quote from: Kindred on December 13, 2019, 10:01:08 AM
ah...   yeah, that is frequently the case with mods that call external scripts.

I didn't have a chance to go to your actual site to look, but here's a little pointer:

ON a page that triggers the warning, do "view source of page"
search in the source code, do a search for "http:"
that should tell you what the actual call is and allow you to (possibly) figure out, from looking at the call or the display code around it, what area is causing the problem.

Then you get to have the fun of tracking down the section of code that the mod modified...  sometimes that is simple, sometimes not.
most mods that add javascript drop it into index.template.php or add it in their own file, via hooks

Yep, that's how I found it.  Plus error console was warning me about the insecure call for that script, and other helpful info which I passed on to Jeff by PM on his site. ;)