I have images (PNG) that are generated dynamically and will be embedded in websites and forums. When an image gets posted on a very busy page, there are a lot many connectio
An Expires
header should help.
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
Make sure you also add public as so:
header('Cache-Control: max-age=86400, public');
Read this also, is very helpful.
The final thing that worked was:
header('Pragma: public');
header('Cache-Control: max-age=86400');
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
header('Content-Type: image/png');
Now the browser does not make requests for the image when loading a page with embeded one.