如何强制服务器绕过HTTP POST的缓存?

时间:2012-01-12 19:00:36

标签: http post

客户端在生成响应时是否可以强制源服务器忽略其缓存?例如,它可以在请求中发送Cache-Control: no-cache吗? RFC似乎只在响应的上下文中讨论Cache-Control: no-cache,而不是请求。

1 个答案:

答案 0 :(得分:1)

回答我自己的问题......

根据http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.1.6

A client's request MAY specify the maximum age it is willing to accept of an unvalidated response; specifying a value of zero forces the cache(s) to revalidate all responses.

根据http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4

The request includes a "no-cache" cache-control directive [...] The server MUST NOT use a cached copy when responding to such a request.