Définir l'en-tête Strict-Transport-Security

Bonjour,

Je souhaite modifier l’en-tête Strict-Transport-Security. J’utilise ce code dans mon app.yml :

run:  
# modifications nginx
  - 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';"

Cela fonctionne pour la première occurrence :
add_header Strict-Transport-Security 'max-age=63072000';

Mais il y en a une autre avec :

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

Est-ce que je fais quelque chose de mal ? Pourquoi la deuxième occurrence de l’en-tête Strict-Transport-Security n’est-elle pas modifiée ?

J’ai testé avec plusieurs personnalisations. Seule la première occurrence de

add_header Strict-Transport-Security

est remplacée. Des indices pour y parvenir ?

Vous devez ajouter global: true aux paramètres de la commande replace.

1 « J'aime »

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