Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: nax - syyskuu 12, 2019, 05:16:57 AP

Otsikko: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 05:16:57 AP
Since installing SSL and using https I have seen an increase in disk usage for a site I "try" to manage. There is minor traffic on the SMF board and nothing has been added to the server in terms of web pages but the % disk used has gone up from 563MB to 723MB since May about 7% of disk space - the increase before that was about 1% per year!

I'm concerned that the disk is going to fill up unless I can find the cause.  I think it's something to do with the public_html/cache as it's the only folder that has a modification date of today.  Can I clear this (and how)?  Is this something to do with https and the image proxy service started after SSL was invoked?  Is there an easy script that I can run periodically using CRON to keep on top of this assuming it's the cause?

I tried clearing the cache in SMF Admin/Maintenance but that had no effect.

TIA
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: Arantor - syyskuu 12, 2019, 05:44:56 AP
It's the image proxy. It takes copies of images that people link to that aren't HTTPS so that when people visit your site, 1) everything is secure and 2) your site isn't drowning in serving up extra work it doesn't have to (by taking a local copy rather than not caching everything)

If you clear it daily you will actually make your site slower for everyone. You would be better served looking at the posts people make and try to change the links to https directly in posts to avoid this.
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 05:55:30 AP
Thanks for that advice (at least I know what it is now), if I deleted content in the directory that was over a month old would that be a better approach (can I just delete it?).  I can ask the users of the forum concerned to use https for image/video links including their avatars.  Most image hosting sites do support https.
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: a10 - syyskuu 12, 2019, 07:36:48 AP
I'd think this should control it? image proxy in server settings, see attach.
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 07:49:28 AP
I already have this set and the Maximum File size is set to 5190KB - which I think was the default.

Looking in the cache there are files  of 3MB and more! see the attached Is there any way to see what these files are then maybe I can see where they're being used in the forum and address the issue.



Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: vbgamer45 - syyskuu 12, 2019, 08:08:20 AP
5190kb is 5.19 megabytes
Not easily no to see the files need to be decoded via the script to be displayed.
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: a10 - syyskuu 12, 2019, 08:15:22 AP
Lainaus käyttäjältä: nax - syyskuu 12, 2019, 07:49:28 AP
I already have this set and the Maximum File size is set to 5190KB - which I think was the default.


Interesting, can't really tell if it's working on my forum as have not reached my set max size.
Maybe the forum experts can tell if \ how the max size is supposed to work.

But is 723MB (or even many GB's) really any problem, hosting space is getting really cheap thsee days. And there is good  benefit in caching the http non-s stuff.

About finding http culprits, it can be done by editing the messages table (have done things with find\replace in notepad++, mainly replacing all outdated internal forum links in posts after domain name change).
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 08:19:58 AP
Lainaus käyttäjältä: nax - syyskuu 12, 2019, 07:49:28 AP
Lainaus käyttäjältä: vbgamer45 - syyskuu 12, 2019, 08:08:20 AP
5190kb is 5.19 megabytes
Not easily no to see the files need to be decoded via the script to be displayed.

So no easy way to find the culprits.  I think I will set the max size to 1024KB most embedded images shouldn't really be more than that don't you think?
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 08:21:25 AP
Lainaus käyttäjältä: a10 - syyskuu 12, 2019, 08:15:22 AP
Lainaus käyttäjältä: nax - syyskuu 12, 2019, 07:49:28 AP
I already have this set and the Maximum File size is set to 5190KB - which I think was the default.


Interesting, can't really tell if it's working on my forum as have not reached my set max size.
Maybe the forum experts can tell if \ how the max size is supposed to work.

But is 723MB (or even many GB's) really any problem, hosting space is getting really cheap thsee days. And there is good  benefit in caching the http non-s stuff.

About finding http culprits, it can be done by editing the messages table (have done things with find\replace in notepad++, mainly replacing all outdated internal forum links in posts after domain name change).

My message table is about 2GB ;)
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: shawnb61 - syyskuu 12, 2019, 10:07:09 AP
You can safely disable the image proxy and clear the cache/images folder.  The only downside is you lose the "padlock" when viewing threads that have links to http:// images in them.

Some of us use cronjobs to keep the cache/images folder pruned to within a certain size.  An example:
   https://github.com/sbulen/sjrbTools/blob/master/proxy-maint-cron.php

I do not recommend editing your messages by hand. 
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 10:53:33 AP
Thanks Shawn, that script is just a little too complicated for me!
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: Arantor - syyskuu 12, 2019, 11:22:19 AP
Lainaus käyttäjältä: shawnb61 - syyskuu 12, 2019, 10:07:09 AP
You can safely disable the image proxy and clear the cache/images folder.  The only downside is you lose the "padlock" when viewing threads that have links to http:// images in them.

Some of us use cronjobs to keep the cache/images folder pruned to within a certain size.  An example:
   https://github.com/sbulen/sjrbTools/blob/master/proxy-maint-cron.php

I do not recommend editing your messages by hand. 

Depends on your browser, some outright won't show the image if it's on http when the site is https.
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: nax - syyskuu 12, 2019, 11:27:25 AP
True, I tried modding some posts and found that.
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: Kindred - syyskuu 12, 2019, 12:05:22 IP
well, I went into the database and did a global replace of the http to https in the cases of known changes to the source (e.g. it is a known pattern for the changes to images hosted on imagbb and other sites like that)  That cut down on the use of the proxy
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: shawnb61 - syyskuu 12, 2019, 03:05:02 IP
Then if the padlock isn't important I would simply suggest disabling the image proxy.  (That's what I do now!)
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: Arantor - syyskuu 12, 2019, 03:38:49 IP
Lainaus käyttäjältä: shawnb61 - syyskuu 12, 2019, 03:05:02 IP
Then if the padlock isn't important I would simply suggest disabling the image proxy.  (That's what I do now!)

That isn't what I said.

There are browsers who won't show any HTTP resource in an HTTPS context at all. The current mainstream browsers will allow (some) mixed content, but it's a policy that I've seen set with Group Policy (e.g. workplace computers) to never allow HTTP inside HTTPS pages.

(The trend is going in the way of more strict, not less. Right now the mainstream browsers will allow mixed content for images but not fonts and some JavaScript. Mozilla has certainly indicated that for more powerful features such as WebRTC, mixed content will not be tolerated.)
Otsikko: Re: Cache size increasing in public_htlm since invoking https
Kirjoitti: shawnb61 - syyskuu 12, 2019, 08:59:44 IP
(Arantor - I wasn't directing that at you, but to the OP.) 

My input to nax still stands - with concern about cache growth, and an inability to get a pruning cron working, the best advice is to disable the image proxy & clear the cache. 

As Arantor points out, the mainstream browsers allow mixed content for images, so you're good. 

I have ~30K users.  I received many complaints from users with the proxy ON (dropped images, another topic entirely...) - but I have never received a single report at all from a user with the image proxy OFF.  My suggestion remains to turn it OFF.