3

I write a simple code:

<?php


echo "<h1>1233422</h1>";

?>

<html>

<img src="screen.png"/>
</html>

there is an image in the html, but when I refresh the browser page the png image is 200.

theoretically the image response status should be 304, why there is 200?

200


Two times request's Response Header are:

HTTP/1.1 200 OK
Content-Type: image/png
server: PhpStorm 10.0.1
date: Fri, 07 Dec 2018 03:35:42 GMT
cache-control: private, must-revalidate
last-modified: Fri, 07 Dec 2018 03:34:56 GMT
content-length: 11437

the second request Headers:

GET /test03-hante/screen.png HTTP/1.1
Host: localhost:63342
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Referer: http://localhost:63342/test03-hante/index.php
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Cookie: wp-settings-time-1=1539853185; Webstorm-b87204fd=531be1b1-a109-47c6-97d9-4dd7b886ebde

you see, there is no If-Modified-Since and If-Non-Match params, why?

26334_zeal
  • 191
  • 11

1 Answers1

2

In browser refresh, HTTP image response status is "200 (cache)" because in refresh the image loaded from your browser cache.

You can learn more from this answer: https://stackoverflow.com/a/1665097/6678086

johirpro
  • 509
  • 4
  • 16
  • the phpStorm webserver should return 304 then client(browser) load the browser cache. – 26334_zeal Dec 07 '18 at 10:12
  • 2
    @26334_zeal Accordingly to the screenshot no request was made to the server for that image -- see "from memory" in Size column. In any case: PhpStorm built-in web server is a pretty simple thing, so it *may* respond differently. But so far it looks normal to me. – LazyOne Dec 07 '18 at 11:29