By Sean Carney on Saturday, 21 January 2017
Posted in Technical Issues
Likes 0
Views 349
Votes 0
I have set up EasySocial to use an Amazon S3 bucket for the images. Right now when I run tests at places like GTmetrix I am being told to fix the lack expired headers on those images. Do you know how to set a header expiration?

Otherwise, might I be better off turning off the S3 bucket and storing them on my server there there are header expirations set. Here you can see how most of the items without the expiring header are those images:

Leverage browser caching
F (38)
SERVER HIGH
What's this mean?
Leverage browser caching for the following cacheable resources:

https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2782/e97443984f38929b5fb8ccae78a18950_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2788/03411e2fe52994fa2e6daf0662ddee30_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2802/98c1684691a8b7b0de29368b62df79da_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2804/c896969bbc54ac522efe8c9a2a7963e7_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2806/e9a454ae5c3fe263c4fa2958cdeefd39_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2807/8de5ca62d836916b45693f41af0e57c0_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2811/1765103450dd9f788a4abcaf6bdd22eb_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2813/f4206049fc9d028b83937d08122d5c18_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2815/6d1f6f362eff4ac86d1f152ab0375f60_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/2825/ce27a58e9fef958a71c62e7a6a4b8b15_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/813/dcf11f423dc45818de20d152f6564219_medium.jpg (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/816/f67eefed1822be9c44b9d174a4913279_medium.png (expiration not specified)
https://s3.amazonaws.com/drcarney-com/media/com_easysocial/avatars/users/828/2418f860b97c69991e345bb8b6437470_medium.jpg (expiration not specified)
https://connect.facebook.net/en_US/sdk.js (20 minutes)
Hey Sean,

it seems like you do not have enabled this option "Delete Files After Upload" from backend setting, mean all the file which uploaded to your amazon S3, those files still exist on your local.

What my suggestion is :

1. Backup your site first before perform following step
2. Set all to 'Local server' from backend > Easysocial > setting > storage (screenshot : http://take.ms/G2oMi )
3. Then wait for your cronjob process and synchronise back to your local server for those files which uploaded into your amazon S3.
4. After that it will update all the image file 'storage' data from your database
5. You can inspect one of your Easysocial image file path, it should link back to your local server path instead of Amazon S3 path.
6. Once everything sync back to your local server, then only switch to "Amazon" option from backend > Easysocial > setting > storage
Then it will wait for Cronjob then upload to your Amazon S3.
·
Tuesday, 24 January 2017 17:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Sean,

We currently do not set the cache control when uploading objects to Amazon S3. Perhaps it would be a good idea to do that now. Try downloading the attached file and upload it into /administrator/components/com_easysocial/includes/storage/amazon/
·
Saturday, 21 January 2017 14:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you so much for giving me that file. I did not see a difference but am assuming that maybe I need to clear out from the S3 bucket all the affected files and then let them become recreated? I did not want to do this without asking first.

Or, would I just replace on the Amazon S3 bucket the file you just had me upload to my server?

Thanks, Sean
·
Sunday, 22 January 2017 09:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Sean,

Before wiping them out, you need to synchronize them back to your Joomla site first otherwise your files will go missing. So once you have synchronized it back to your site, the files will slowly be moved back to your site.

Once everything is back, only then activate it to sync with Amazon again. The modifications to this file only affects new files that haven't sync to Amazon yet.
·
Sunday, 22 January 2017 13:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark,

The files are still on my local server. If I delete them from Amazon will they sync automatically or is there something I have to click on either within EasySocial on within my Amazon Consule in order to initiate the sync?

Thanks, Sean
·
Tuesday, 24 January 2017 04:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much.

I will do this today.

Sean
·
Wednesday, 25 January 2017 21:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok. It worked perfectly. I actually created a new bucket name as well so a brand new bucket was created. Now the GTmetrix is no longer reporting those images as not having cache expiration stamps on them.

Thank you,
Sean
·
Wednesday, 25 January 2017 22:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating Sean, glad that your issues are resolved now
·
Thursday, 26 January 2017 00:48
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post