nginx与弱etags

时间:2017-12-27 16:00:27

标签: nginx restangular etags

背景
当客户端发送Accept-Encoding: gzip时,nginx会生成弱etags https://twitter.com/samsaffron/status/486387129165942784

我使用restangular来调用端点
Restangular接收一个弱etag并将其发送到if-None-Match标题中,而不对etag进行任何修改 https://github.com/mgonto/restangular/blob/d55c4392b184e659c11f50e225d64c3a04da6572/src/restangular.js#L588
但是nginx不会将etag与它在if-None-Match中收到的内容相匹配, 它会发送200 OK http响应,同时应发送发送304 Not Modified http响应 邮差: weak etag, 200 response

如果我在if-None-Match标题(条W/)中将etag作为强etag发送,则nginx会发送304响应。
邮差: strong etag, 304 response

如何解决此问题?
如果将W/发送为if-None-Match,那么它应该从etag中剥离出来吗? MDN表示无需在if-None-Match

中发送W /

may be prefixed by `W/` to indicate that the weak comparison algorithm should be used (This is useless with If-None-Match as it only uses that algorithm). https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match

或者nginx是否能够匹配它,即使它是弱etag?

nginx版本1.13.3

0 个答案:

没有答案