Hidden features of HTTP

前端 未结 13 1077
醉话见心
醉话见心 2021-01-29 17:38

What hidden features of HTTP do you think are worth mentioning?

By hidden features I mean features that already are part of the standard but widely rath

13条回答
  •  生来不讨喜
    2021-01-29 17:49

    In Dynamic content use Last_Modified or ETag header

    At times you have dynamic content that can be large and/or costly to generate and that may not change from request to request. You can add a Last_Modified or ETag header to the your generated response.

    At the top of your expensive dynamic code you can use the If_Modified_Since or the If_None_Match to determine if the content requestor already has is still current. If it is change the response status to "304 Unmodified" and end the request.

    Some server-side technologies provide such features formally but you can do the above even in lowly ASP-Classic.

    Note this differs from setting Cache-Control, Expires headers in that it ensures the client always has the latest info on request.

提交回复
热议问题