Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
要重塑“ HTTP 304未修改的客户端重定向响应代码表示无需重新发送请求的资源”:
您一次请求资源(来自
/profiles
的数据),服务器会发送您的服务。该数据具有200 OK
状态。现在,当您请求相同的资源(/profiles
)及其数据从第一个请求中没有更改时,服务器将使用304未修改的
响应,因为它假设您是您的已经有数据 - 自从请求200 OK
以来,它尚未修改。您说您没有在第一个请求中缓存数据,但是服务器是假设您会(例如
304未修改
的MDN文档,“ 这是对缓存资源的隐含重定向“),并试图节省资源。您必须确定在您的特定情况下
到期
标题,并且在那一刻之后才重新召集,或者if-none-match
eTAG
eTAG header告诉服务器您没有可使用的资源的缓存版本To rephrase "the HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources":
You request a resource (the data from
/profiles
) once, and the server sends you that data with a200 OK
status. Now when you request the same resource (/profiles
) and its data hasn't changed from the first request, the server will respond with a304 Not Modified
since it assumes you already have the data — it hasn't been modified since the request that was200 OK
.You say you didn't cache the data in the first request but the server is assuming you would (like the MDN docs for
304 Not Modified
say, "It is an implicit redirection to a cached resource") and is trying to save resources.You'll have to determine if it's best in your specific situation to
Expires
header and only rerequest after that moment in time, orIf-None-Match
ETag
header as to tell the server that you don't have a cached version of the resource to use