Cache-Control header 的多次使用
Multipy usage of Cache-Control header
是否可以多次添加 Cache-Control
header?
看到下面的header是什么设置生效了?
Cache-Control: no-cache, no-store, private
Cache-Control: no-cache
设置是累积的吗?
来自RFC 7230, 3.2.2. Field Order:
A recipient MAY combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma.
此请求的处理方式与:
Cache-Control: no-cache, no-store, private, no-cache
注意 in RFC 7234, 4.2.1. Calculating Freshness Lifetime:
When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives), the directive's value is considered invalid.
我相信你举的例子是有效的,但是,例如:
Cache-Control: max-age=0
Cache-Control: max-age=3600
将无效。