【问题标题】:Nginx - How to add multiple values to headerNginx - 如何向标题添加多个值
【发布时间】:2019-09-03 23:26:11
【问题描述】:

我有一个不包含 nginx 的标头。假设我有一个标题,例如Strict-Transport-Securty

add_header Strict-Transport-Security    'max-age=31536000; preload'  always;

max-agepreload 应该用分号和空格隔开吗?没有空间?只有逗号?如何包含多个值? add_header nginx 文档没有提到这一点。

【问题讨论】:

    标签: nginx


    【解决方案1】:

    分号是分隔Strict-Transport-Securty 标头值的正确方法。你的线路

    add_header Strict-Transport-Security 'max-age=31536000; preload' always;
    

    是正确的。


    您可能无法在 Nginx 文档中找到它,因为这是在 IETF specification 中标准化的:

    Strict-Transport-Security = "Strict-Transport-Security" ":"
                                [ 指令 ] *( ";" [ 指令 ] )

    请看这里:https://www.rfc-editor.org/rfc/rfc6797#section-6.1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-23
      • 2018-10-22
      • 1970-01-01
      • 1970-01-01
      • 2015-01-08
      • 2017-10-09
      • 2022-07-05
      相关资源
      最近更新 更多