Cap'n Refsmmat Posted March 14, 2011 Share Posted March 14, 2011 I'm running Varnish to cache the uploads/ and public/ directories and save my webserver some effort. Unfortunately, IPB names all new avatars according to a predictable scheme: av-###.jpg, with the number being the user's userid. If the user uploads a new avatar, it replaces the old one with the same filename. This interacts badly with Varnish, which keeps the old avatar in cache and serves it instead of the new avatar. With lighttpd configured to send Expires: headers a week in the future (as is recommended), Varnish will keep the wrong avatar cached for up to a week. IPB should give new avatars a new filename to logically distinguish them. I know it's possible, because the converter from vBulletin used the filenames from vB's avatars instead of the IPB scheme. Perhaps something as av-###-1.jpg and av-###-2.jpg and so on. Link to comment Share on other sites More sharing options...
Lockjit Posted July 30, 2011 Share Posted July 30, 2011 I'm having exactly the same problem Link to comment Share on other sites More sharing options...
• Jay • Posted July 31, 2011 Share Posted July 31, 2011 I'm running Varnish to cache the uploads/ and public/ directories and save my webserver some effort. Unfortunately, IPB names all new avatars according to a predictable scheme: av-###.jpg, with the number being the user's userid. If the user uploads a new avatar, it replaces the old one with the same filename. This interacts badly with Varnish, which keeps the old avatar in cache and serves it instead of the new avatar. With lighttpd configured to send Expires: headers a week in the future (as is recommended), Varnish will keep the wrong avatar cached for up to a week. IPB should give new avatars a new filename to logically distinguish them. I know it's possible, because the converter from vBulletin used the filenames from vB's avatars instead of the IPB scheme. Perhaps something as av-###-1.jpg and av-###-2.jpg and so on. This would also resolve a CloudFlare issue where member avatars don't get updated for hours after it's changed due to caching. Link to comment Share on other sites More sharing options...
Ihia Posted August 3, 2011 Share Posted August 3, 2011 I am having the same problem. Link to comment Share on other sites More sharing options...
ensoph Posted October 28, 2011 Share Posted October 28, 2011 i'm having this issue too. tracker says it has been solved, but it doesn't seem so... Link to comment Share on other sites More sharing options...
Feld0 Posted October 29, 2011 Share Posted October 29, 2011 A possible approach to this may be to add a timestamp either as a query string or part of the avatar's filename. Anything that would make a browser or origin pull CDN see it as a new file. "Why don't I see my new avatar?" is one of the most frequently asked questions on one of my forums, and to be frank, it gets tedious after a while to keep telling everyone to clear their cache or manually purging their avatar from my CDN. Link to comment Share on other sites More sharing options...
ensoph Posted October 31, 2011 Share Posted October 31, 2011 yes, this is also what most other forum packages do. Link to comment Share on other sites More sharing options...
ensoph Posted November 1, 2011 Share Posted November 1, 2011 i solved this on my forum. now it stores the avatar's last edit time in the database as a query string (the file's name in the filesystem stays the same), i.e. profile/photo-2.jpg?1320180009. since it involves (literally) two lines of code, it would be nice to see this activated by default. in /admin/sources/classes/member/photo.php, find this (should be line 127):$save = array( 'pp_main_photo' => $photo['final_location'], and replace with: $save = array( 'pp_main_photo' => $photo['final_location'].'?'.time(), then find this (line 130): 'pp_thumb_photo' => $photo['t_final_location'], and replace with: 'pp_thumb_photo' => $photo['t_final_location'].'?'.time(), haven't had any problem so far, though it might (or might not) break avatar-related cleanup tools. Link to comment Share on other sites More sharing options...
Jυra Posted November 2, 2011 Share Posted November 2, 2011 I like showing off the number of avatars I changed. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.