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

제가 무언가를 잘못하고 있는 것인가요? 왜 Strict-Transport-Security 헤더의 두 번째 발생 위치는 수정되지 않는 것인가요?

여러 가지 커스터마이징으로 테스트해 보았습니다. 하지만 add_header Strict-Transport-Security의 첫 번째 발생 부분만 대체됩니다. 이 문제를 해결할 수 있는 힌트가 있을까요?

replace 명령 매개변수에 global: true를 추가해야 합니다.