What takes precedence: the ETag or Last-Modified HTTP header?

后端 未结 3 2054
生来不讨喜
生来不讨喜 2020-12-07 12:24

For two subsequent requests, which of the following two headers is given more weight by browsers should one of them change: ETag or Last-Modified?

3条回答
  •  执念已碎
    2020-12-07 12:46

    Isn't it more like an "OR" expression. In pseudo code:

    if ETagFromServer != ETagOnClient || LastModifiedFromServer != LastModifiedOnClient
       GetFromServer
    else
       GetFromCache
    

提交回复
热议问题