Is there a perhaps a better way to set Expires and Cache-Control (with public) in one just two lines?推荐答案是的,使用多个 Cache-Control 标头是有效且等效的.Yes, it's valid and equivalent to use multiple Cache-Control headers.来自 HTTP 1.1 规范:多个消息头字段相同的字段名可能存在于一条消息当且仅当整个该头字段的字段值是定义为逗号分隔的列表[即,#(values)].一定有可能组合多个标题字段成一个字段名称:字段值"对,不改变语义的消息,通过附加每个后续字段值到第一个,每个都用逗号分隔. Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma.很容易验证此规定是否适用于 Cache-Control 标头,因为 如何它的定义:It's easy to verify that this provision applies to the Cache-Control header because of how it's defined:Cache-Control = "Cache-Control" ":" 1#cache-directive Cache-Control = "Cache-Control" ":" 1#cache-directive要了解如何解释上述行,请参阅规范的符号约定.1# 表示一个或多个逗号分隔的列表".To understand how to interpret the line above, see the spec's notational conventions. The 1# means "a comma-separated list of one or more". 这篇关于缓存控制头重复;有效与否?(Nginx)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 11:59
查看更多