Jus*_*tin 6 api http http-headers
Strict-Transport-Security
为 API 响应(即不维护状态的请求)设置标头是否有意义,并且很可能不是来自浏览器。
不幸的是,HSTS RFC 没有提及 API。
在 2.1 用例下,它指出:
o Web browser user wishes to interact with various web sites (some
arbitrary, some known) in a secure fashion.
o Web site deployer wishes to offer their site in an explicitly
secure fashion for their own, as well as their users', benefit.
Run Code Online (Sandbox Code Playgroud)
https://www.rfc-editor.org/rfc/rfc6797#section-2.1
由于它明确指出“Web 浏览器”,我认为可以安全地假设 HSTS 是为通过 Web 浏览器访问的资源而设计的。
如果您认为您的 API 将来可能会被网络浏览器使用,那么我建议添加 HSTS 标头。如果您的 API 永远不会通过网络浏览器访问,那么您不需要 HSTS 标头,但是,如果您决定将来应该通过网络浏览器访问它,则可能值得将其添加到“面向未来”的 API 中(和/或您将来允许 HTTP 连接)。
归档时间: |
|
查看次数: |
5589 次 |
最近记录: |