如果相同的 URL 可以提供不同的内容类型,应该接受 Vary include 吗?

If the same URL can serve different content types shoud Vary include accept?

如果相同的 URL 可以为同一资源提供不同的内容类型,Vary 必须包含 Accept 吗?还是浏览器缓存和代理将其理解为隐含的?

示例:

GET /some/thing HTTP/1.1
Accept: application/json

这个回复

HTTP/1.1 200 OK
Transfer-Encoding: gzip
Content-Type: application/json
Cache-Control: max-age=3600, must-revalidate
Vary: Transfer-Encoding

{...}

或者这个

HTTP/1.1 200 OK
Transfer-Encoding: gzip
Content-Type: application/json
Cache-Control: max-age=3600, must-revalidate
Vary: Transfer-Encoding, Accept

{...}

实际上 RFC 并不表示对内容类型进行任何类型的“隐式”或特殊处理(接受)header...

A Vary field value consisting of a comma-separated list of names indicates that the named request header fields, known as the selecting header fields, might have a role in selecting the representation.