ElkArte Community

Project Support => Support => Topic started by: ahrasis on March 05, 2019, 09:36:39 am

Title: How To Add Expires Headers To External Images
Post by: ahrasis on March 05, 2019, 09:36:39 am
As the title says, how do we add expires headers to external images like my gravatar in here?
Title: Re: How To Add Expires Headers To External Images
Post by: emanuele on March 05, 2019, 05:02:02 pm
You cannot.
It's the server that sets the expiry date, unless you control the server you can't do much about it.
Title: Re: How To Add Expires Headers To External Images
Post by: ahrasis on March 05, 2019, 06:59:40 pm
Thank you. So roughly I understand that we should rather cache the external image to add "expires headers" via our own server settings.

Do we have addons to cache external images? Will your Image Caching (https://www.elkarte.net/community/index.php?topic=1791.0) addon or @tino's External Image Proxy for http images (https://www.elkarte.net/community/index.php?topic=5119.0) or @Spuds' Image Cache (https://www.elkarte.net/community/index.php?topic=5345.0) work for this purpose, you think?
Title: Re: How To Add Expires Headers To External Images
Post by: emanuele on March 06, 2019, 09:13:31 am
But out of curiosity, why would you want to add an expire header to external images?
Title: Re: How To Add Expires Headers To External Images
Post by: radu81 on March 06, 2019, 10:43:14 am
to get the maximum score on pingdom or similar websites? ;) Your score is already perfect, I get a C score
https://screenshots.firefox.com/OkTZwfwoZWPeKzWN/tools.pingdom.com
Title: Re: How To Add Expires Headers To External Images
Post by: ahrasis on March 06, 2019, 09:08:47 pm
Shouldn't expires headers be our good practise, even on the external images or other external files?

But I get it that we cannot add it to the external files since we are not in control of their servers, except by caching them locally.

So, can any of the mentioned addons actually cache them?
Title: Re: How To Add Expires Headers To External Images
Post by: emanuele on March 07, 2019, 07:20:55 am
It may be, but honestly control the web is just a waste of time and resources to me. :P

External images are cached because of the http/https thingy, not sure though if all images are cached or only the http ones.
Title: Re: How To Add Expires Headers To External Images
Post by: tino on March 08, 2019, 05:15:06 pm
My mod won’t mess with the expires headers. It just passes the image through to the other application. If you use the nginx option you can modify the headers or use your own custom camo or weserv server aswell actually.