Why the Cache-Control code of Browser Caching is not working for image types?

As I was following through the tutorial on the Browser Caching with Nginx’s header Module on Ubuntu 16.04—-testing-browser-caching,

it is successfully working for all file types except for the image types.

The Gtmetrix Speed tester is recommending to leverage the browser cache for images and showing expiration not specified for images.

How can I fix the issue to leverage browser caching for images?



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi there @Nusrat,

If you do a curl -I http://localhost/test.jpg what are the headers that you get back?

Also is Gtmetrix reporting specific image types that are problematic or is it for all images on your site?

Regards, Bobby