1

在 http 响应中,可以有标头Strict-Transport-Security。我确信它必须用 Train-Case 编写,就像在 dropbox.com 上一样:

$ curl --silent --head https://dropbox.com | grep -i strict
Strict-Transport-Security: max-age=15552000; includeSubDomains

但是在一个网站上,我看到它是用 kebab-case 写的(这个网站不能公开访问,这就是为什么我不给出它的链接):

$ curl --silent --head https://... | grep -i strict
strict-transport-security: max-age=31536000; includeSubDomains

在 Strict-Transport-Security 标头中使用所有小写字母是否正确?

4

1 回答 1

4

HTTP 规范RFC 7230 第 3.2节规定标头名称不区分大小写。因此,如果您愿意,可以将它们以小写形式发送。

然而,传统的做法是使用规范文档的大小写来发送它们。如果只是为了让人们更轻松地解决交通问题。

于 2015-05-21T15:48:13.903 回答