【发布时间】:2020-07-03 01:31:39
【问题描述】:
我有一个同时提供 HTML 和多种 RDF 格式的 Web 应用程序(在下面的示例中,它是 RDF/XML)。 页面加载为 HTML(自然),然后请求其自己的 URL 作为 RDF/XML。
问题:看起来 Firefox 74.0(64 位)(在 Windows 上)混合了来自这两个请求的 ETag 值,忽略了不同的 Content-Types 以及存在的 Vary: Accept。
当我重新加载页面时,我可以看到它使用 HTML 请求中第二个 (RDF/XML) 响应中的 ETag: "95e11fbc9e816b56",反之亦然:
Request URL: https://localhost:4443/6a6283d2-2a40-4882-b89d-8073a7c30e17/
Host: localhost:4443
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://localhost:4443/6a6283d2-2a40-4882-b89d-8073a7c30e17/
Connection: keep-alive
Cookie: _ga=GA1.1.828629977.1584086266; LinkedDataHub.first-time-message=true
Upgrade-Insecure-Requests: 1
If-None-Match: "95e11fbc9e816b56"
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Strict-Transport-Security: max-age=31536000;includeSubDomains
ETag: "95e11fbc139f56de"
Cache-Control: max-age=3600, public
Last-Modified: Wed, 12 Feb 2020 23:05:15 GMT
Vary: Accept-Charset,Accept,Accept-Encoding
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Content-Encoding: gzip
Date: Sun, 22 Mar 2020 10:13:43 GMT
Request URL: https://localhost:4443/6a6283d2-2a40-4882-b89d-8073a7c30e17/
Host: localhost:4443
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Accept: application/rdf+xml
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://localhost:4443/d376ee88-ff7d-48ee-81c4-1220c9f482f0/
Connection: keep-alive
Cookie: _ga=GA1.1.828629977.1584086266; LinkedDataHub.first-time-message=true
If-None-Match: "95e11fbc139f56de"
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Strict-Transport-Security: max-age=31536000;includeSubDomains
ETag: "95e11fbc9e816b56"
Last-Modified: Wed, 12 Feb 2020 23:05:15 GMT
Vary: Accept-Charset,Accept
Content-Type: application/rdf+xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 22 Mar 2020 10:13:55 GMT
在 Chrome 上,我根本无法让它发送 If-None-Match 标头,但这可能是 due to the self-signed certificate。
请注意,ETag 的值相似但不同:"95e11fbc139f56de" 与 "95e11fbc9e816b56"。
这对我来说没有任何意义。有什么解释吗?谢谢。
相关规范为Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests。
【问题讨论】:
-
我建议为出现此错误的浏览器打开新的错误。
标签: http http-headers browser-cache etag http-caching