Why browser does not send “If-None-Match” header?

前端 未结 6 2009
一整个雨季
一整个雨季 2020-12-24 08:20

I\'m trying to download (and hopefully cache) a dynamically loaded image in PHP. Here are the headers sent and received:

Request:

GET /url:resource/P         


        
6条回答
  •  星月不相逢
    2020-12-24 08:51

    Posting this for future me...

    I was having a similar problem, I was sending ETag in the response, but the HTTP client wasn't sending a If-None-Match header in subsequent requests (which was strange because it was the day before).

    Turns out I was using http://localhost:9000 for development (which didn't use If-None-Match) - by switching to http://127.0.0.1:9000 Chrome1 automatically started sending the If-None-Match header in requests again.

    Additionally - ensure Devtools > Network > Disable Cache [ ] is unchecked.

    Chrome: Version 71.0.3578.98 (Official Build) (64-bit)

    1 I can't find anywhere this is documented - I'm assuming Chrome was responsible for this logic.

提交回复
热议问题