为什么浏览器会在 GET 时缓存资源(图像、js 等),但在 POST 后重新请求所有内容? 302重定向?

发布于 2024-07-25 20:15:54 字数 130 浏览 1 评论 0原文

我们已经正确设置了 ETag 和过期标头,并且在浏览网站而不发布内容时,它确实非常快捷。 然而,在任何 POST 之后(几乎总是跟随 302),您可以看到浏览器重新请求所有图像。 有什么可能导致这种情况吗? 有没有一个设置可以处理这个问题?

We've got our ETags and expiry headers setup properly and when browsing around the site without posting it is really very snappy. However, after any POST (which is almost invariably followed with a 302) you can see the browser re-request all the images. Is there something that could be causing this? Is there a setting that handles this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美煞众生 2024-08-01 20:15:54

我相信通常您仍然会收到一个请求,但标头中带有“If-Modified-Since”——至少这是我观察到的,即使标头过期。 响应应该是 304(未修改),这是超快的。 或者你是说所有图像都完全重新加载?

了解有关 If-ModifiedSince 的更多信息
阅读 HTTP RFC 中的 If-Modified-Since

I believe typically you still get a request but with 'If-Modified-Since' in the header -- at least that's what I've observed, even with expires headers. The response should be 304 (not modified) which is ultraquick. Or are you saying all the images are reloaded entirely?

Read more on If-Modified Since
Read about If-Modified-Since in HTTP RFC

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文