NFC Image caching

Siebter

Less soul, more mind
Hey!

I'm not familiar with forum software, but it seems like newFC does not cache images in the viewers browser, which makes navigating through threads with many images very slow when revisiting them, as every image will be downloaded again.

Images hosted via an external hoster like imgbb.com/ are not affected by this, this happens only with images uploaded via the forum.

Could this be fixed somehow?
 
Siebter,
  • Like
Reactions: Jill NYC

pakalolo

Toolbag v1.1 (candidate)
Staff member
I looked into this. Xenforo automatically disallows caching local attachments in your browser because they are permission controlled. This affects us as well as you, because it means increased server load and bandwidth use. There is no easy way to change this.
 
pakalolo,
  • Like
Reactions: Jill NYC

Siebter

Less soul, more mind
Hm, I see – thx fort looking into this.

I agree, it's not only slowing things down, but also increases traffic quite a bit.

Maybe in the long run it would be better to remove the option to upload local attachments and ask newFC members to use external services. I suppose the amount of locally uploaded images will skyrocket soon. Before people get used to the convenience of it too much...
 

Vapor Ninja

News and reviews since 2014
Maybe in the long run it would be better to remove the option to upload local attachments and ask newFC members to use external services.

I think this would be a wise move, lest the site slows down to a crawl.
Speaking of which, does imgur allow us to link their images here, or will they block us like they did with the old site ?
Would like to use imgur, but using my own websapce for now.
 
Vapor Ninja,

pakalolo

Toolbag v1.1 (candidate)
Staff member
I think this would be a wise move, lest the site slows down to a crawl.
Speaking of which, does imgur allow us to link their images here, or will they block us like they did with the old site ?
Would like to use imgur, but using my own websapce for now.

imgur has not blocked us and we're trying to ensure that they don't, hence we have no Classifieds section.
 

JCat

Well-Known Member
Accessory Maker
I was thinking about it ... and there should be a way to make these attachments cache; default behaviour of the web server maybe isn't too, however, one should be able to override it.

@pakalolo ... is your host using NGINX? Apache? Other? Do you have access to the web server config? Not just the XenForo config?

Permissions shouldn't affect caching ... as caching is client side ... maybe as a default they disable caching as when browsing from a public terminal, if logged in and accessing secured attachments, then someone else logged in, under same PC account, would still have cached images (so I can understand this default behaviour); that being said, for FC's needs, attachments are not needed to be secured, so just a matter of enabling caching for all /attachments/*.(jpg|png|etc)

Here's a post on the XenForo forums discussing enabling caching for attachments ... (I'll test locally on my NGINX/WSL2 setup as well)


Edit: Server-side caching wouldn't work for attachments due to permissions, but there is no reason we shouldn't enable client-side caching through the web server config ...


Edit Edit: @pakalolo, a little more research ... so 2 options from what I can see:

1. Override web server cache header for attachments (I can get you the config for NGINX for this anyways ... will take longer for Apache as I don't have an Apache server setup ...) -- ie. XF 2.0 - Why attachments are un-cachable?

2. Use an add-on to change way attachments are stored -- eg. [bd] Attachment Store for XenForo 2.0
 
Last edited:
JCat,

pakalolo

Toolbag v1.1 (candidate)
Staff member
I was thinking about it ... and there should be a way to make these attachments cache; default behaviour of the web server maybe isn't too, however, one should be able to override it.

@pakalolo ... is your host using NGINX? Apache? Other? Do you have access to the web server config? Not just the XenForo config?

Permissions shouldn't affect caching ... as caching is client side ... maybe as a default they disable caching as when browsing from a public terminal, if logged in and accessing secured attachments, then someone else logged in, under same PC account, would still have cached images (so I can understand this default behaviour); that being said, for FC's needs, attachments are not needed to be secured, so just a matter of enabling caching for all /attachments/*.(jpg|png|etc)

Here's a post on the XenForo forums discussing enabling caching for attachments ... (I'll test locally on my NGINX/WSL2 setup as well)


Edit: Server-side caching wouldn't work for attachments due to permissions, but there is no reason we shouldn't enable client-side caching through the web server config ...


Edit Edit: @pakalolo, a little more research ... so 2 options from what I can see:

1. Override web server cache header for attachments (I can get you the config for NGINX for this anyways ... will take longer for Apache as I don't have an Apache server setup ...) -- ie. XF 2.0 - Why attachments are un-cachable?

2. Use an add-on to change way attachments are stored -- eg. [bd] Attachment Store for XenForo 2.0

I'll send you a PM.
 
pakalolo,
  • Like
Reactions: JCat
Top Bottom