问题描述
我对W/在未添加时在etag中的显示方式感到困惑.我正在使用Node.js http服务器模块,并具有Nginx作为反向代理.我在浏览器中看到由Node.js服务器生成的Etag,但带有W/标签.
I am confused by how the W/ appears in the etag when I have not added it. I am using Node.js http server module and have a Nginx as reverse proxy. I am getting the browser see the Etag generated by the Node.js server but with a W/ tagged to it.
有人可以解释W/的来源吗?浏览器是否会根据其确定为弱标签来插入该标签?我希望浏览器在发送时得到它.没有W/前缀.
Can someone explain where that W/ comes from? Does the browser insert that based upon its determination that it is a weak etag? I want the browser to get it as I sent it. Without the W/ prefix.
这是浏览器中显示的Etag标头.
Here is the Etag header as seen in the browser.
etag: W/"asv1534746804282-d62serveav"
当尝试与if-none-match比较时,我必须剥离W/.另外,对于304状态响应,我是否还需要发送Etag?
When trying to compare with if-none-match, I have to strip the W/.Also, with the 304 status response, do I again have to send the Etag?
编辑:我自己添加了W/,以便Nginx对其进行修改.我希望我的假设是正确的.好像是.
EDIT: I added the W/ myself so that Nginx leaves it unmodified. I hope my assumption is correct. It appears to be.
推荐答案
如果您要求nginx动态gzip您的内容,它将把您的ETag转换为弱标签.这是规范所必需的,因为强大的ETag仅可用于逐字节相同的内容.
If you ask nginx to dynamically gzip your content it will convert your ETags into weak ones. This is required by the specification, since a strong ETag can only be used for content that is byte-for-byte identical.
这篇关于etag中的W/出现在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!