What HTTP response headers are required

前端 未结 2 1713
醉梦人生
醉梦人生 2020-11-29 22:47

What HTTP response headers are required to be sent from server to the client?

I working to optimize the HTTP response headers to minimize the HTTP response overhead.

2条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 23:23

    It depends on the specifics of the response, but generally, a response from an origin server should have:

    • Date
    • Content-Type
    • Server

    and either Content-Length, Transfer-Encoding or Connection: close.

    If you want to do caching, add Cache-Control (e.g., with max-age); Expires isn't generally necessary any more. If you want clients to be able to validate, add Last-Modified or ETag.

提交回复
热议问题