gpt4 book ai didi

etag - 单个 Web 服务器和 ETag

转载 作者:行者123 更新时间:2023-12-04 21:58:52 24 4
gpt4 key购买 nike

有谁知道在托管在单个网络服务器上的网络应用程序上禁用 ETag 是否值得?目前我们不在我们的应用程序中使用 ETag。

如果值得禁用它们 - 为什么?

非常感谢。

最佳答案

我不知道这是否有帮助,但您可以在此处阅读有关 etag 的信息: http://developer.yahoo.net/blog/archives/2007/07/high_performanc_11.html

这是what Jeff Atwood thinks关于 ETag:

ETags are a checksum field served up with each server file so the client can tell if the server resource is different from the cached version the client holds locally. Yahoo recommends turning ETags off because they cause problems on server farms due to the way they are generated with machine-specific markers. So unless you run a server farm, you should ignore this guidance. It'll only make your site perform worse because the client will have a more difficult time determining if its cache is stale or fresh. It is possible for the client to use the existing last-modified date fields to determine whether the cache is stale, but last-modified is a weak validator, whereas Entity Tag (ETag) is a strong validator. Why trade strength for weakness?

还有interview with Steve Souders在 .NET Rocks 上可能会有所帮助:

Steve Souders: ... the default implementation of IIS and Apache, they put both of those servers, put something in the e-tag that will make it very likely that if the user ever has to check the validity of that resource, the browsers are going to be incorrectly told that the resource is no longer valid. So in Apache’s case, what they put in the e-tag is the INO number of the file on that web server so that if you have more than one web servers hosting your site which most large websites do, that INO number is never going to match across two servers so if yesterday the user went to server one and today they tried to validate that resource and they go to server 2, the e-tag is not going to match, e-tag overrides last modified date so instead of just returning a 200-byte 304 response, the server has to return a 50k response of the entire image.

关于etag - 单个 Web 服务器和 ETag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/442730/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com