etag 中的 W/ 从哪里出现?

Where does the W/ in an etag appear from?

当我没有添加 W/ 时,我对它在 etag 中的显示方式感到困惑。 我正在使用 Node.js http 服务器模块并使用 Nginx 作为反向代理。我让浏览器看到由 Node.js 服务器生成的 Etag,但带有 W/ 标记。

有人可以解释一下 W/ 的来源吗?浏览器是否根据确定它是弱 etag 来插入它?我希望浏览器在我发送时得到它。没有 W/ 前缀。

这是在浏览器中看到的 Etag header。

etag: W/"asv1534746804282-d62serveav"

当试图与 if-none-match 进行比较时,我必须去掉 W/。 另外,对于 304 状态响应,我是否必须再次发送 Etag?

编辑:我自己添加了 W/ 以便 Nginx 保持不变。我希望我的假设是正确的。好像是。

如果您要求 nginx 动态压缩您的内容,它会将您的 ETag 转换为弱 ETag。这是 the specification 所要求的,因为强 ETag 只能用于逐字节相同的内容。

A validator is weak if it is shared by two or more representations of a given resource at the same time, unless those representations have identical representation data. For example, if the origin server sends the same validator for a representation with a gzip content coding applied as it does for a representation with no content coding, then that validator is weak.