Why does the browser can’t cache my image?

I am using nginx and Adaptive Images to provide dynamic-sized images based on the device resolution. The response header set by the adaptive images.php file is shown below, but every time I refresh the page, browse The browser will request images again. Why doesn’t the browser cache these images? The browser is Google Chrome, and no matter how I update it, it seems to set max-age=0 in the request header. I tried F5, press Ctrl F5 and enter the URL in the address bar and press Enter.

Request header:

GET /img/photos/p8.jpg HTTP/1.1
Host: example.com
Connection : keep-alive
Cache-Control: max-age=0
Accept: image/webp,*/*;q=0.8
Pragma: no-cache
If-Modified -Since: Wed, 16 Jul 2014 12:01:31 GMT
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36< br />Referer: http://example.com/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,en-GB;q= 0.6

Response header:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Jul 2014 12: 08:55 GMT
Content-Type: image/jpeg
Content-Length: 391104
X-Powered-By: PHP/5.4.30
Cache-Control: private, max -age=604800
Expires: Wed, 23 Jul 2014 12:08:55 GMT
Last-Modified: Wed, 16 Jul 2014 12:08:55 GMT
Connection: Keep-Alive< /pre>
It turns out that this seems to be a Chrome feature

See this other answer why: Chrome doesn't cache images/js /css

I am using nginx and Adaptive Images to provide dynamically sized images according to the device resolution. The response header set by the adaptive images.php file is shown below, but every When the page is refreshed the next time, the browser will request images again. Why doesn't the browser cache these images? The browser is Google Chrome, and no matter how I update it, it seems to set max-age=0 in the request header. I tried F5, press Ctrl F5 and enter the URL in the address bar and press Enter.

Request header:

GET /img/photos/p8.jpg HTTP/1.1
Host: example.com
Connection : keep-alive
Cache-Control: max-age=0
Accept: image/webp,*/*;q=0.8
Pragma: no-cache
If-Modified -Since: Wed, 16 Jul 2014 12:01:31 GMT
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36< br />Referer: http://example.com/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,en-GB;q= 0.6

Response header:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Jul 2014 12: 08:55 GMT
Content-Type: image/jpeg
Content-Length: 391104
X-Powered-By: PHP/5.4.30
Cache-Control: private, max -age=604800
Expires: Wed, 23 Jul 2014 12:08:55 GMT
Last-Modified: Wed, 16 Jul 2014 12:08:55 GMT
Connection: Keep-Alive< /pre>

It turns out that this seems to be a Chrome feature

See why this other answer: Chrome doesn’t cache images/js/css

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4312 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.