What's the rationale behind the HTTP Date header?

后端 未结 3 1598
时光取名叫无心
时光取名叫无心 2021-01-01 09:15

I have read RFC 2616, but still I wonder, what the Date field is for. There is the Last-Modified field, that actually has a meaning besides just serving metadata, that is, f

3条回答
  •  伪装坚强ぢ
    2021-01-01 09:35

    Please consider not to use the Date Header as it is on the list of the "Forbidden header names".

    The following description from the MDN web docs might help:


    A forbidden header name is the name of any HTTP header that cannot be modified programmatically; specifically, an HTTP request header name (in contrast with a Forbidden response header name).

    Modifying such headers is forbidden because the user agent retains full control over them. Names starting with Sec- are reserved for creating new headers safe from APIs using Fetch that grant developers control over headers, such as XMLHttpRequest.

    Forbidden header names start with Proxy- or Sec-, or are one of the following names:

    • Accept-Charset
    • List item
    • Accept-Encoding
    • Access-Control-Request-Headers
    • Access-Control-Request-Method
    • Connection
    • Content-Length
    • Cookie
    • Cookie2
    • Date
    • DNT
    • Expect
    • Host
    • Keep-Alive
    • Origin
    • Proxy-
    • Sec-
    • Referer
    • TE
    • Trailer
    • Transfer-Encoding
    • Upgrade
    • Via

提交回复
热议问题