Strict-Transport-Securityヘッダーを設定する

こんにちは。

Strict-Transport-Security ヘッダーを変更したいです。app.yml でこのコードを使用しています。

run:  
# nginx modifications
  - replace:       
      filename: "/etc/nginx/conf.d/discourse.conf"       
      from: /add_header Strict-Transport-Security.+/       
      to: "add_header Strict-Transport-Security 'max-age=31536000; includeSubdomains; preload';"

これは最初の出現箇所で機能します。
add_header Strict-Transport-Security 'max-age=63072000';

しかし、別の箇所に以下のようなものがあります。

location @discourse {
add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain

何か間違っていますか? 2番目の Strict-Transport-Security ヘッダーの出現箇所が変更されないのはなぜですか?

いくつかのカスタマイズを試しましたが、add_header Strict-Transport-Security の最初の出現箇所しか置き換えられません。これを実現するためのヒントはありますか?

global: true を replace コマンドのパラメータに追加する必要があります。

「いいね!」 1

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.