what’s the difference between Expires and Cache-Control headers?

后端 未结 7 949
心在旅途
心在旅途 2020-12-02 04:22

What’s the difference between Expires and Cache-Control headers?

7条回答
  •  情话喂你
    2020-12-02 04:55

    Cache-Control was defined in HTTP/1.1, tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds: Cache-Control: max-age=3600.

    The Expires header field gives the date/time after which the response is considered stale. The Expires value is an HTTP-date timestamp: Expires: Tue, 18 Jul 2017 16:07:23 GMT.

    If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field.

提交回复
热议问题